summary refs log tree commit diff
path: root/src/database/migration/postgres/1723644478176-webhookSourceChannel.ts
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-06-11 23:18:02 +0200
committerRory& <root@rory.gay>2026-06-12 17:58:18 +0200
commit83e60464ad2675f09ddee02f6b166bef22f53f33 (patch)
tree9e12033c00c8420166f52c397b461cad288277fe /src/database/migration/postgres/1723644478176-webhookSourceChannel.ts
parentFix recursive import in database (diff)
downloadserver-ts-83e60464ad2675f09ddee02f6b166bef22f53f33.tar.xz
Move migrations to database
Diffstat (limited to 'src/database/migration/postgres/1723644478176-webhookSourceChannel.ts')
-rw-r--r--src/database/migration/postgres/1723644478176-webhookSourceChannel.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/database/migration/postgres/1723644478176-webhookSourceChannel.ts b/src/database/migration/postgres/1723644478176-webhookSourceChannel.ts
new file mode 100644

index 00000000..00fe413f --- /dev/null +++ b/src/database/migration/postgres/1723644478176-webhookSourceChannel.ts
@@ -0,0 +1,17 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class WebhookSourceChannel1723644478176 implements MigrationInterface { + name = "WebhookSourceChannel1723644478176"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query("ALTER TABLE webhooks ADD COLUMN source_channel_id VARCHAR(255) NULL DEFAULT NULL"); + await queryRunner.query( + "ALTER TABLE webhooks ADD CONSTRAINT FK_d64f38834fa676f6caa4786ddd6 FOREIGN KEY (source_channel_id) REFERENCES channels (id) ON UPDATE NO ACTION ON DELETE CASCADE", + ); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query("ALTER TABLE webhooks DROP CONSTRAINT FK_d64f38834fa676f6caa4786ddd6"); + await queryRunner.query("ALTER TABLE webhooks DROP COLUMN source_channel_id"); + } +}