Dashboard work and related
This commit is contained in:
parent
7bda2b1763
commit
b230a73a6f
44 changed files with 637 additions and 272 deletions
|
@ -0,0 +1,13 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class RenameBackendDashboardStuffToAPI1561282151982 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE dashboard_users RENAME api_users`);
|
||||
await queryRunner.query(`ALTER TABLE dashboard_logins RENAME api_logins`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE api_users RENAME dashboard_users`);
|
||||
await queryRunner.query(`ALTER TABLE api_logins RENAME dashboard_logins`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class RenameAllowedGuildGuildIdToId1561282552734 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query("ALTER TABLE `allowed_guilds` CHANGE COLUMN `guild_id` `id` BIGINT(20) NOT NULL FIRST;");
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query("ALTER TABLE `allowed_guilds` CHANGE COLUMN `id` `guild_id` BIGINT(20) NOT NULL FIRST;");
|
||||
}
|
||||
}
|
31
src/migrations/1561282950483-CreateApiUserInfoTable.ts
Normal file
31
src/migrations/1561282950483-CreateApiUserInfoTable.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { MigrationInterface, QueryRunner, Table } from "typeorm";
|
||||
|
||||
export class CreateApiUserInfoTable1561282950483 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
name: "api_user_info",
|
||||
columns: [
|
||||
{
|
||||
name: "id",
|
||||
type: "bigint",
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
name: "data",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
name: "updated_at",
|
||||
type: "datetime",
|
||||
default: "now()",
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.dropTable("api_user_info", true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class RenameApiUsersToApiPermissions1561283165823 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE api_users RENAME api_permissions`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE api_permissions RENAME api_users`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class DropUserDataFromLoginsAndPermissions1561283405201 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query("ALTER TABLE `api_logins` DROP COLUMN `user_data`");
|
||||
await queryRunner.query("ALTER TABLE `api_permissions` DROP COLUMN `username`");
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(
|
||||
"ALTER TABLE `api_logins` ADD COLUMN `user_data` TEXT NOT NULL COLLATE 'utf8mb4_swedish_ci' AFTER `user_id`",
|
||||
);
|
||||
await queryRunner.query(
|
||||
"ALTER TABLE `api_permissions` ADD COLUMN `username` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_swedish_ci' AFTER `user_id`",
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue