diff options
Diffstat (limited to 'src/util/migrations')
-rw-r--r-- | src/util/migrations/1633864260873-EmojiRoles.ts | 8 | ||||
-rw-r--r-- | src/util/migrations/1633864669243-EmojiUser.ts | 12 | ||||
-rw-r--r-- | src/util/migrations/1633881705509-VanityInvite.ts | 14 | ||||
-rw-r--r-- | src/util/migrations/1634308884591-Stickers.ts | 73 | ||||
-rw-r--r-- | src/util/migrations/1634424361103-Presence.ts | 5 | ||||
-rw-r--r-- | src/util/migrations/1634426540271-MigrationTimestamp.ts | 6 | ||||
-rw-r--r-- | src/util/migrations/1660678870706-opencordFixes.ts | 37 | ||||
-rw-r--r-- | src/util/migrations/1660689892073-mobileFixes2.ts | 25 |
8 files changed, 122 insertions, 58 deletions
diff --git a/src/util/migrations/1633864260873-EmojiRoles.ts b/src/util/migrations/1633864260873-EmojiRoles.ts index f0d709f2..31ced96b 100644 --- a/src/util/migrations/1633864260873-EmojiRoles.ts +++ b/src/util/migrations/1633864260873-EmojiRoles.ts @@ -4,10 +4,14 @@ export class EmojiRoles1633864260873 implements MigrationInterface { name = "EmojiRoles1633864260873"; public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(`ALTER TABLE "emojis" ADD "roles" text NOT NULL DEFAULT ''`); + await queryRunner.query( + `ALTER TABLE "emojis" ADD "roles" text NOT NULL DEFAULT ''`, + ); } public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(`ALTER TABLE "emojis" DROP COLUMN column_name "roles"`); + await queryRunner.query( + `ALTER TABLE "emojis" DROP COLUMN column_name "roles"`, + ); } } diff --git a/src/util/migrations/1633864669243-EmojiUser.ts b/src/util/migrations/1633864669243-EmojiUser.ts index 982405d7..9610216b 100644 --- a/src/util/migrations/1633864669243-EmojiUser.ts +++ b/src/util/migrations/1633864669243-EmojiUser.ts @@ -7,17 +7,21 @@ export class EmojiUser1633864669243 implements MigrationInterface { await queryRunner.query(`ALTER TABLE "emojis" ADD "user_id" varchar`); try { await queryRunner.query( - `ALTER TABLE "emojis" ADD CONSTRAINT FK_fa7ddd5f9a214e28ce596548421 FOREIGN KEY (user_id) REFERENCES users(id)` + `ALTER TABLE "emojis" ADD CONSTRAINT FK_fa7ddd5f9a214e28ce596548421 FOREIGN KEY (user_id) REFERENCES users(id)`, ); } catch (error) { console.error( - "sqlite doesn't support altering foreign keys: https://stackoverflow.com/questions/1884818/how-do-i-add-a-foreign-key-to-an-existing-sqlite-table" + "sqlite doesn't support altering foreign keys: https://stackoverflow.com/questions/1884818/how-do-i-add-a-foreign-key-to-an-existing-sqlite-table", ); } } public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(`ALTER TABLE "emojis" DROP COLUMN column_name "user_id"`); - await queryRunner.query(`ALTER TABLE "emojis" DROP CONSTRAINT FK_fa7ddd5f9a214e28ce596548421`); + await queryRunner.query( + `ALTER TABLE "emojis" DROP COLUMN column_name "user_id"`, + ); + await queryRunner.query( + `ALTER TABLE "emojis" DROP CONSTRAINT FK_fa7ddd5f9a214e28ce596548421`, + ); } } diff --git a/src/util/migrations/1633881705509-VanityInvite.ts b/src/util/migrations/1633881705509-VanityInvite.ts index 45485310..16072473 100644 --- a/src/util/migrations/1633881705509-VanityInvite.ts +++ b/src/util/migrations/1633881705509-VanityInvite.ts @@ -5,15 +5,21 @@ export class VanityInvite1633881705509 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise<void> { try { - await queryRunner.query(`ALTER TABLE "emojis" DROP COLUMN vanity_url_code`); - await queryRunner.query(`ALTER TABLE "emojis" DROP CONSTRAINT FK_c2c1809d79eb120ea0cb8d342ad`); + await queryRunner.query( + `ALTER TABLE "emojis" DROP COLUMN vanity_url_code`, + ); + await queryRunner.query( + `ALTER TABLE "emojis" DROP CONSTRAINT FK_c2c1809d79eb120ea0cb8d342ad`, + ); } catch (error) {} } public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(`ALTER TABLE "emojis" ADD vanity_url_code varchar`); await queryRunner.query( - `ALTER TABLE "emojis" ADD CONSTRAINT FK_c2c1809d79eb120ea0cb8d342ad FOREIGN KEY ("vanity_url_code") REFERENCES "invites"("code") ON DELETE NO ACTION ON UPDATE NO ACTION` + `ALTER TABLE "emojis" ADD vanity_url_code varchar`, + ); + await queryRunner.query( + `ALTER TABLE "emojis" ADD CONSTRAINT FK_c2c1809d79eb120ea0cb8d342ad FOREIGN KEY ("vanity_url_code") REFERENCES "invites"("code") ON DELETE NO ACTION ON UPDATE NO ACTION`, ); } } diff --git a/src/util/migrations/1634308884591-Stickers.ts b/src/util/migrations/1634308884591-Stickers.ts index fbc4649f..f7b83242 100644 --- a/src/util/migrations/1634308884591-Stickers.ts +++ b/src/util/migrations/1634308884591-Stickers.ts @@ -1,35 +1,64 @@ -import { MigrationInterface, QueryRunner, Table, TableColumn, TableForeignKey } from "typeorm"; +import { + MigrationInterface, + QueryRunner, + Table, + TableColumn, + TableForeignKey, +} from "typeorm"; export class Stickers1634308884591 implements MigrationInterface { name = "Stickers1634308884591"; public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.dropForeignKey("read_states", "FK_6f255d873cfbfd7a93849b7ff74"); + await queryRunner.dropForeignKey( + "read_states", + "FK_6f255d873cfbfd7a93849b7ff74", + ); await queryRunner.changeColumn( "stickers", "tags", - new TableColumn({ name: "tags", type: "varchar", isNullable: true }) + new TableColumn({ + name: "tags", + type: "varchar", + isNullable: true, + }), ); await queryRunner.changeColumn( "stickers", "pack_id", - new TableColumn({ name: "pack_id", type: "varchar", isNullable: true }) + new TableColumn({ + name: "pack_id", + type: "varchar", + isNullable: true, + }), + ); + await queryRunner.changeColumn( + "stickers", + "type", + new TableColumn({ name: "type", type: "integer" }), ); - await queryRunner.changeColumn("stickers", "type", new TableColumn({ name: "type", type: "integer" })); await queryRunner.changeColumn( "stickers", "format_type", - new TableColumn({ name: "format_type", type: "integer" }) + new TableColumn({ name: "format_type", type: "integer" }), ); await queryRunner.changeColumn( "stickers", "available", - new TableColumn({ name: "available", type: "boolean", isNullable: true }) + new TableColumn({ + name: "available", + type: "boolean", + isNullable: true, + }), ); await queryRunner.changeColumn( "stickers", "user_id", - new TableColumn({ name: "user_id", type: "boolean", isNullable: true }) + new TableColumn({ + name: "user_id", + type: "boolean", + isNullable: true, + }), ); await queryRunner.createForeignKey( "stickers", @@ -39,17 +68,33 @@ export class Stickers1634308884591 implements MigrationInterface { referencedColumnNames: ["id"], referencedTableName: "users", onDelete: "CASCADE", - }) + }), ); await queryRunner.createTable( new Table({ name: "sticker_packs", columns: [ - new TableColumn({ name: "id", type: "varchar", isPrimary: true }), + new TableColumn({ + name: "id", + type: "varchar", + isPrimary: true, + }), new TableColumn({ name: "name", type: "varchar" }), - new TableColumn({ name: "description", type: "varchar", isNullable: true }), - new TableColumn({ name: "banner_asset_id", type: "varchar", isNullable: true }), - new TableColumn({ name: "cover_sticker_id", type: "varchar", isNullable: true }), + new TableColumn({ + name: "description", + type: "varchar", + isNullable: true, + }), + new TableColumn({ + name: "banner_asset_id", + type: "varchar", + isNullable: true, + }), + new TableColumn({ + name: "cover_sticker_id", + type: "varchar", + isNullable: true, + }), ], foreignKeys: [ new TableForeignKey({ @@ -58,7 +103,7 @@ export class Stickers1634308884591 implements MigrationInterface { referencedTableName: "stickers", }), ], - }) + }), ); } diff --git a/src/util/migrations/1634424361103-Presence.ts b/src/util/migrations/1634424361103-Presence.ts index 729955b8..a71cb253 100644 --- a/src/util/migrations/1634424361103-Presence.ts +++ b/src/util/migrations/1634424361103-Presence.ts @@ -4,7 +4,10 @@ export class Presence1634424361103 implements MigrationInterface { name = "Presence1634424361103"; public async up(queryRunner: QueryRunner): Promise<void> { - queryRunner.addColumn("sessions", new TableColumn({ name: "activites", type: "text" })); + queryRunner.addColumn( + "sessions", + new TableColumn({ name: "activites", type: "text" }), + ); } public async down(queryRunner: QueryRunner): Promise<void> {} diff --git a/src/util/migrations/1634426540271-MigrationTimestamp.ts b/src/util/migrations/1634426540271-MigrationTimestamp.ts index 3208b25b..fb596906 100644 --- a/src/util/migrations/1634426540271-MigrationTimestamp.ts +++ b/src/util/migrations/1634426540271-MigrationTimestamp.ts @@ -7,7 +7,11 @@ export class MigrationTimestamp1634426540271 implements MigrationInterface { await queryRunner.changeColumn( "migrations", "timestamp", - new TableColumn({ name: "timestampe", type: "bigint", isNullable: false }) + new TableColumn({ + name: "timestampe", + type: "bigint", + isNullable: false, + }), ); } diff --git a/src/util/migrations/1660678870706-opencordFixes.ts b/src/util/migrations/1660678870706-opencordFixes.ts index 1f10c212..53c561ce 100644 --- a/src/util/migrations/1660678870706-opencordFixes.ts +++ b/src/util/migrations/1660678870706-opencordFixes.ts @@ -1,53 +1,52 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class opencordFixes1660678870706 implements MigrationInterface { - name = 'opencordFixes1660678870706' + name = "opencordFixes1660678870706"; - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE \`users\` ADD \`purchased_flags\` int NOT NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`users\` ADD \`premium_usage_flags\` int NOT NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`user_settings\` ADD \`friend_discovery_flags\` int NOT NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`user_settings\` ADD \`view_nsfw_guilds\` tinyint NOT NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`user_settings\` ADD \`passwordless\` tinyint NOT NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`users\` CHANGE \`mfa_enabled\` \`mfa_enabled\` tinyint NOT NULL `); - } + } - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE \`users\` CHANGE \`mfa_enabled\` \`mfa_enabled\` tinyint NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`user_settings\` DROP COLUMN \`passwordless\` `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`user_settings\` DROP COLUMN \`view_nsfw_guilds\` `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`user_settings\` DROP COLUMN \`friend_discovery_flags\` `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`users\` DROP COLUMN \`premium_usage_flags\` `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`users\` DROP COLUMN \`purchased_flags\` `); - } - -} \ No newline at end of file + } +} diff --git a/src/util/migrations/1660689892073-mobileFixes2.ts b/src/util/migrations/1660689892073-mobileFixes2.ts index bd28694e..63e7e032 100644 --- a/src/util/migrations/1660689892073-mobileFixes2.ts +++ b/src/util/migrations/1660689892073-mobileFixes2.ts @@ -1,37 +1,36 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class mobileFixes21660689892073 implements MigrationInterface { - name = 'mobileFixes21660689892073' + name = "mobileFixes21660689892073"; - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE \`user_settings\` ADD \`banner_color\` varchar(255) NULL `); await queryRunner.query(` UPDATE \`channels\` SET \`nsfw\` = 0 WHERE \`nsfw\` = NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL `); await queryRunner.query(` UPDATE \`guilds\` SET \`nsfw\` = 0 WHERE \`nsfw\` = NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL `); - } + } - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`user_settings\` DROP COLUMN \`banner_color\` `); - } - -} \ No newline at end of file + } +} |