summary refs log tree commit diff
path: root/src/util/migrations/1633881705509-VanityInvite.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-25 18:24:21 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-25 23:35:18 +1000
commit0d23eaba09a4878520bf346af4cead90d76829fc (patch)
treed930eacceff0b407b44abe55f01d8e3c5dfbfa34 /src/util/migrations/1633881705509-VanityInvite.ts
parentAllow edited_timestamp to passthrough in handleMessage (diff)
downloadserver-0d23eaba09a4878520bf346af4cead90d76829fc.tar.xz
Refactor to mono-repo + upgrade packages
Diffstat (limited to 'src/util/migrations/1633881705509-VanityInvite.ts')
-rw-r--r--src/util/migrations/1633881705509-VanityInvite.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util/migrations/1633881705509-VanityInvite.ts b/src/util/migrations/1633881705509-VanityInvite.ts
new file mode 100644
index 00000000..45485310
--- /dev/null
+++ b/src/util/migrations/1633881705509-VanityInvite.ts
@@ -0,0 +1,19 @@
+import { MigrationInterface, QueryRunner } from "typeorm";
+
+export class VanityInvite1633881705509 implements MigrationInterface {
+	name = "VanityInvite1633881705509";
+
+	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`);
+		} 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`
+		);
+	}
+}