summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-15 07:16:41 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-15 07:16:41 +0200
commit551fa530cf2d19b62707c40ca1202bcd6d92c0c0 (patch)
tree2b68f77283d99d470f1d61af1e2dfc25518bbfff /src
parentFix missing stuff (diff)
downloadserver-551fa530cf2d19b62707c40ca1202bcd6d92c0c0.tar.xz
Update package, sync migrations
Diffstat (limited to 'src')
-rw-r--r--src/migrations/mariadb/1660540527213-sync_migrations.ts127
-rw-r--r--src/migrations/sqlite/1660538628956-sync_migrations.ts172
-rw-r--r--src/util/migrations/mariadb/1660260587556-CodeCleanup4.ts39
-rw-r--r--src/util/migrations/mariadb/1660416072362-InvitersAreDeletable.ts56
4 files changed, 299 insertions, 95 deletions
diff --git a/src/migrations/mariadb/1660540527213-sync_migrations.ts b/src/migrations/mariadb/1660540527213-sync_migrations.ts
new file mode 100644
index 00000000..8cc1d2f1
--- /dev/null
+++ b/src/migrations/mariadb/1660540527213-sync_migrations.ts
@@ -0,0 +1,127 @@
+import { MigrationInterface, QueryRunner } from "typeorm";
+
+export class syncMigrations1660540527213 implements MigrationInterface {
+    name = 'syncMigrations1660540527213'
+
+    public async up(queryRunner: QueryRunner): Promise<void> {
+        await queryRunner.query(`
+            ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\` CHANGE \`settings\` \`settingsId\` text NOT NULL
+        `);
+        await queryRunner.query(`
+            CREATE TABLE \`user_settings\` (
+                \`id\` varchar(255) NOT NULL,
+                \`afk_timeout\` int NULL,
+                \`allow_accessibility_detection\` tinyint NULL,
+                \`animate_emoji\` tinyint NULL,
+                \`animate_stickers\` int NULL,
+                \`contact_sync_enabled\` tinyint NULL,
+                \`convert_emoticons\` tinyint NULL,
+                \`custom_status\` text NULL,
+                \`default_guilds_restricted\` tinyint NULL,
+                \`detect_platform_accounts\` tinyint NULL,
+                \`developer_mode\` tinyint NULL,
+                \`disable_games_tab\` tinyint NULL,
+                \`enable_tts_command\` tinyint NULL,
+                \`explicit_content_filter\` int NULL,
+                \`friend_source_flags\` text NULL,
+                \`gateway_connected\` tinyint NULL,
+                \`gif_auto_play\` tinyint NULL,
+                \`guild_folders\` text NULL,
+                \`guild_positions\` text NULL,
+                \`inline_attachment_media\` tinyint NULL,
+                \`inline_embed_media\` tinyint NULL,
+                \`locale\` varchar(255) NULL,
+                \`message_display_compact\` tinyint NULL,
+                \`native_phone_integration_enabled\` tinyint NULL,
+                \`render_embeds\` tinyint NULL,
+                \`render_reactions\` tinyint NULL,
+                \`restricted_guilds\` text NULL,
+                \`show_current_game\` tinyint NULL,
+                \`status\` varchar(255) NULL,
+                \`stream_notifications_enabled\` tinyint NULL,
+                \`theme\` varchar(255) NULL,
+                \`timezone_offset\` int NULL,
+                PRIMARY KEY (\`id\`)
+            ) ENGINE = InnoDB
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`channels\`
+            ADD \`flags\` int NULL
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`channels\`
+            ADD \`default_thread_rate_limit_per_user\` int NULL
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`guilds\`
+            ADD \`premium_progress_bar_enabled\` tinyint NULL
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\` DROP COLUMN \`settingsId\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\`
+            ADD \`settingsId\` varchar(255) NULL
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\`
+            ADD UNIQUE INDEX \`IDX_76ba283779c8441fd5ff819c8c\` (\`settingsId\`)
+        `);
+        await queryRunner.query(`
+            CREATE UNIQUE INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\` (\`settingsId\`)
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\`
+            ADD CONSTRAINT \`FK_76ba283779c8441fd5ff819c8cf\` FOREIGN KEY (\`settingsId\`) REFERENCES \`user_settings\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`invites\`
+            ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION
+        `);
+    }
+
+    public async down(queryRunner: QueryRunner): Promise<void> {
+        await queryRunner.query(`
+            ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\` DROP FOREIGN KEY \`FK_76ba283779c8441fd5ff819c8cf\`
+        `);
+        await queryRunner.query(`
+            DROP INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\` DROP INDEX \`IDX_76ba283779c8441fd5ff819c8c\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\` DROP COLUMN \`settingsId\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\`
+            ADD \`settingsId\` text NOT NULL
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`guilds\` DROP COLUMN \`premium_progress_bar_enabled\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`channels\` DROP COLUMN \`default_thread_rate_limit_per_user\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`channels\` DROP COLUMN \`flags\`
+        `);
+        await queryRunner.query(`
+            DROP TABLE \`user_settings\`
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`users\` CHANGE \`settingsId\` \`settings\` text NOT NULL
+        `);
+        await queryRunner.query(`
+            ALTER TABLE \`invites\`
+            ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION
+        `);
+    }
+
+}
diff --git a/src/migrations/sqlite/1660538628956-sync_migrations.ts b/src/migrations/sqlite/1660538628956-sync_migrations.ts
new file mode 100644
index 00000000..9cdc064f
--- /dev/null
+++ b/src/migrations/sqlite/1660538628956-sync_migrations.ts
@@ -0,0 +1,172 @@
+import { MigrationInterface, QueryRunner } from "typeorm";
+
+export class syncMigrations1660538628956 implements MigrationInterface {
+    name = 'syncMigrations1660538628956'
+
+    public async up(queryRunner: QueryRunner): Promise<void> {
+        await queryRunner.query(`
+            CREATE TABLE "temporary_channels" (
+                "id" varchar PRIMARY KEY NOT NULL,
+                "created_at" datetime NOT NULL,
+                "name" varchar,
+                "icon" text,
+                "type" integer NOT NULL,
+                "last_message_id" varchar,
+                "guild_id" varchar,
+                "parent_id" varchar,
+                "owner_id" varchar,
+                "last_pin_timestamp" integer,
+                "default_auto_archive_duration" integer,
+                "position" integer,
+                "permission_overwrites" text,
+                "video_quality_mode" integer,
+                "bitrate" integer,
+                "user_limit" integer,
+                "nsfw" boolean,
+                "rate_limit_per_user" integer,
+                "topic" varchar,
+                "retention_policy_id" varchar,
+                "flags" integer,
+                "default_thread_rate_limit_per_user" integer,
+                CONSTRAINT "FK_3873ed438575cce703ecff4fc7b" FOREIGN KEY ("owner_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
+                CONSTRAINT "FK_3274522d14af40540b1a883fc80" FOREIGN KEY ("parent_id") REFERENCES "channels" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
+                CONSTRAINT "FK_c253dafe5f3a03ec00cd8fb4581" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
+            )
+        `);
+        await queryRunner.query(`
+            INSERT INTO "temporary_channels"(
+                    "id",
+                    "created_at",
+                    "name",
+                    "icon",
+                    "type",
+                    "last_message_id",
+                    "guild_id",
+                    "parent_id",
+                    "owner_id",
+                    "last_pin_timestamp",
+                    "default_auto_archive_duration",
+                    "position",
+                    "permission_overwrites",
+                    "video_quality_mode",
+                    "bitrate",
+                    "user_limit",
+                    "nsfw",
+                    "rate_limit_per_user",
+                    "topic",
+                    "retention_policy_id"
+                )
+            SELECT "id",
+                "created_at",
+                "name",
+                "icon",
+                "type",
+                "last_message_id",
+                "guild_id",
+                "parent_id",
+                "owner_id",
+                "last_pin_timestamp",
+                "default_auto_archive_duration",
+                "position",
+                "permission_overwrites",
+                "video_quality_mode",
+                "bitrate",
+                "user_limit",
+                "nsfw",
+                "rate_limit_per_user",
+                "topic",
+                "retention_policy_id"
+            FROM "channels"
+        `);
+        await queryRunner.query(`
+            DROP TABLE "channels"
+        `);
+        await queryRunner.query(`
+            ALTER TABLE "temporary_channels"
+                RENAME TO "channels"
+        `);
+    }
+
+    public async down(queryRunner: QueryRunner): Promise<void> {
+        await queryRunner.query(`
+            ALTER TABLE "channels"
+                RENAME TO "temporary_channels"
+        `);
+        await queryRunner.query(`
+            CREATE TABLE "channels" (
+                "id" varchar PRIMARY KEY NOT NULL,
+                "created_at" datetime NOT NULL,
+                "name" varchar,
+                "icon" text,
+                "type" integer NOT NULL,
+                "last_message_id" varchar,
+                "guild_id" varchar,
+                "parent_id" varchar,
+                "owner_id" varchar,
+                "last_pin_timestamp" integer,
+                "default_auto_archive_duration" integer,
+                "position" integer,
+                "permission_overwrites" text,
+                "video_quality_mode" integer,
+                "bitrate" integer,
+                "user_limit" integer,
+                "nsfw" boolean,
+                "rate_limit_per_user" integer,
+                "topic" varchar,
+                "retention_policy_id" varchar,
+                CONSTRAINT "FK_3873ed438575cce703ecff4fc7b" FOREIGN KEY ("owner_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
+                CONSTRAINT "FK_3274522d14af40540b1a883fc80" FOREIGN KEY ("parent_id") REFERENCES "channels" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
+                CONSTRAINT "FK_c253dafe5f3a03ec00cd8fb4581" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
+            )
+        `);
+        await queryRunner.query(`
+            INSERT INTO "channels"(
+                    "id",
+                    "created_at",
+                    "name",
+                    "icon",
+                    "type",
+                    "last_message_id",
+                    "guild_id",
+                    "parent_id",
+                    "owner_id",
+                    "last_pin_timestamp",
+                    "default_auto_archive_duration",
+                    "position",
+                    "permission_overwrites",
+                    "video_quality_mode",
+                    "bitrate",
+                    "user_limit",
+                    "nsfw",
+                    "rate_limit_per_user",
+                    "topic",
+                    "retention_policy_id"
+                )
+            SELECT "id",
+                "created_at",
+                "name",
+                "icon",
+                "type",
+                "last_message_id",
+                "guild_id",
+                "parent_id",
+                "owner_id",
+                "last_pin_timestamp",
+                "default_auto_archive_duration",
+                "position",
+                "permission_overwrites",
+                "video_quality_mode",
+                "bitrate",
+                "user_limit",
+                "nsfw",
+                "rate_limit_per_user",
+                "topic",
+                "retention_policy_id"
+            FROM "temporary_channels"
+        `);
+        await queryRunner.query(`
+            DROP TABLE "temporary_channels"
+        `);
+    }
+
+}
diff --git a/src/util/migrations/mariadb/1660260587556-CodeCleanup4.ts b/src/util/migrations/mariadb/1660260587556-CodeCleanup4.ts
deleted file mode 100644
index 98da67db..00000000
--- a/src/util/migrations/mariadb/1660260587556-CodeCleanup4.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { MigrationInterface, QueryRunner } from "typeorm";
-
-export class CodeCleanup41660260587556 implements MigrationInterface {
-    name = 'CodeCleanup41660260587556'
-
-    public async up(queryRunner: QueryRunner): Promise<void> {
-        await queryRunner.query(`
-            ALTER TABLE \`users\`
-            ADD \`settingsId\` varchar(255) NULL
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`users\`
-            ADD UNIQUE INDEX \`IDX_76ba283779c8441fd5ff819c8c\` (\`settingsId\`)
-        `);
-        await queryRunner.query(`
-            CREATE UNIQUE INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\` (\`settingsId\`)
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`users\`
-            ADD CONSTRAINT \`FK_76ba283779c8441fd5ff819c8cf\` FOREIGN KEY (\`settingsId\`) REFERENCES \`user_settings\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION
-        `);
-    }
-
-    public async down(queryRunner: QueryRunner): Promise<void> {
-        await queryRunner.query(`
-            ALTER TABLE \`users\` DROP FOREIGN KEY \`FK_76ba283779c8441fd5ff819c8cf\`
-        `);
-        await queryRunner.query(`
-            DROP INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\`
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`users\` DROP INDEX \`IDX_76ba283779c8441fd5ff819c8c\`
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`users\` DROP COLUMN \`settingsId\`
-        `);
-    }
-
-}
diff --git a/src/util/migrations/mariadb/1660416072362-InvitersAreDeletable.ts b/src/util/migrations/mariadb/1660416072362-InvitersAreDeletable.ts
deleted file mode 100644
index 8374eafb..00000000
--- a/src/util/migrations/mariadb/1660416072362-InvitersAreDeletable.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { MigrationInterface, QueryRunner } from "typeorm";
-
-export class InvitersAreDeletable1660416072362 implements MigrationInterface {
-    name = 'InvitersAreDeletable1660416072362'
-
-    public async up(queryRunner: QueryRunner): Promise<void> {
-        await queryRunner.query(`
-            ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
-        `);
-        await queryRunner.query(`
-            DROP INDEX \`IDX_76ba283779c8441fd5ff819c8c\` ON \`users\`
-        `);
-        await queryRunner.query(`
-            CREATE TABLE \`plugin_config\` (
-                \`key\` varchar(255) NOT NULL,
-                \`value\` text NULL,
-                PRIMARY KEY (\`key\`)
-            ) ENGINE = InnoDB
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`channels\`
-            ADD \`flags\` int NULL
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`channels\`
-            ADD \`default_thread_rate_limit_per_user\` int NULL
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`invites\`
-            ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION
-        `);
-    }
-
-    public async down(queryRunner: QueryRunner): Promise<void> {
-        await queryRunner.query(`
-            ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`channels\` DROP COLUMN \`default_thread_rate_limit_per_user\`
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`channels\` DROP COLUMN \`flags\`
-        `);
-        await queryRunner.query(`
-            DROP TABLE \`plugin_config\`
-        `);
-        await queryRunner.query(`
-            CREATE UNIQUE INDEX \`IDX_76ba283779c8441fd5ff819c8c\` ON \`users\` (\`settingsId\`)
-        `);
-        await queryRunner.query(`
-            ALTER TABLE \`invites\`
-            ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION
-        `);
-    }
-
-}