Dashboard work and related

This commit is contained in:
Dragory 2019-06-23 19:18:41 +03:00
parent 7bda2b1763
commit b230a73a6f
44 changed files with 637 additions and 272 deletions

View file

@ -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`);
}
}

View file

@ -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;");
}
}

View 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);
}
}

View file

@ -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`);
}
}

View file

@ -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`",
);
}
}