From 44859db499f080e3a341f3e7fa5e44611fc2f887 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 12 Aug 2022 01:46:42 +0200 Subject: Push local state... --- .../postgres/1660257815436-CodeCleanup2.ts | 59 ++++++++++++++++++++++ .../postgres/1660258372154-CodeCleanup3.ts | 19 +++++++ .../postgres/1660260565996-CodeCleanup4.ts | 33 ++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 util/src/migrations/postgres/1660257815436-CodeCleanup2.ts create mode 100644 util/src/migrations/postgres/1660258372154-CodeCleanup3.ts create mode 100644 util/src/migrations/postgres/1660260565996-CodeCleanup4.ts (limited to 'util/src/migrations/postgres') diff --git a/util/src/migrations/postgres/1660257815436-CodeCleanup2.ts b/util/src/migrations/postgres/1660257815436-CodeCleanup2.ts new file mode 100644 index 00000000..511c2f5a --- /dev/null +++ b/util/src/migrations/postgres/1660257815436-CodeCleanup2.ts @@ -0,0 +1,59 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class CodeCleanup21660257815436 implements MigrationInterface { + name = 'CodeCleanup21660257815436' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + CREATE TABLE "user_settings" ( + "id" character varying NOT NULL, + "afk_timeout" integer, + "allow_accessibility_detection" boolean, + "animate_emoji" boolean, + "animate_stickers" integer, + "contact_sync_enabled" boolean, + "convert_emoticons" boolean, + "custom_status" text, + "default_guilds_restricted" boolean, + "detect_platform_accounts" boolean, + "developer_mode" boolean, + "disable_games_tab" boolean, + "enable_tts_command" boolean, + "explicit_content_filter" integer, + "friend_source_flags" text, + "gateway_connected" boolean, + "gif_auto_play" boolean, + "guild_folders" text, + "guild_positions" text, + "inline_attachment_media" boolean, + "inline_embed_media" boolean, + "locale" character varying, + "message_display_compact" boolean, + "native_phone_integration_enabled" boolean, + "render_embeds" boolean, + "render_reactions" boolean, + "restricted_guilds" text, + "show_current_game" boolean, + "status" character varying, + "stream_notifications_enabled" boolean, + "theme" character varying, + "timezone_offset" integer, + CONSTRAINT "PK_00f004f5922a0744d174530d639" PRIMARY KEY ("id") + ) + `); + await queryRunner.query(` + ALTER TABLE "guilds" + ADD "premium_progress_bar_enabled" boolean + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE "guilds" DROP COLUMN "premium_progress_bar_enabled" + `); + await queryRunner.query(` + DROP TABLE "user_settings" + `); + } + +} diff --git a/util/src/migrations/postgres/1660258372154-CodeCleanup3.ts b/util/src/migrations/postgres/1660258372154-CodeCleanup3.ts new file mode 100644 index 00000000..e2823a54 --- /dev/null +++ b/util/src/migrations/postgres/1660258372154-CodeCleanup3.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class CodeCleanup31660258372154 implements MigrationInterface { + name = 'CodeCleanup31660258372154' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE "users" DROP COLUMN "settings" + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE "users" + ADD "settings" text NOT NULL + `); + } + +} diff --git a/util/src/migrations/postgres/1660260565996-CodeCleanup4.ts b/util/src/migrations/postgres/1660260565996-CodeCleanup4.ts new file mode 100644 index 00000000..0aaf7197 --- /dev/null +++ b/util/src/migrations/postgres/1660260565996-CodeCleanup4.ts @@ -0,0 +1,33 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class CodeCleanup41660260565996 implements MigrationInterface { + name = 'CodeCleanup41660260565996' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE "users" + ADD "settingsId" character varying + `); + await queryRunner.query(` + ALTER TABLE "users" + ADD CONSTRAINT "UQ_76ba283779c8441fd5ff819c8cf" UNIQUE ("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 { + await queryRunner.query(` + ALTER TABLE "users" DROP CONSTRAINT "FK_76ba283779c8441fd5ff819c8cf" + `); + await queryRunner.query(` + ALTER TABLE "users" DROP CONSTRAINT "UQ_76ba283779c8441fd5ff819c8cf" + `); + await queryRunner.query(` + ALTER TABLE "users" DROP COLUMN "settingsId" + `); + } + +} -- cgit 1.5.1