summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2024-08-14 10:51:56 -0400
committerGitHub <noreply@github.com>2024-08-14 10:51:56 -0400
commitbb256650516dc4cb5b0912ed5d6c43aeb1da04ef (patch)
treefe5f66ab0c29edc5cebae2830f972fb2f440fcba /src
parentMerge pull request #1161 from DEVTomatoCake/feat/bio-max-length-config (diff)
parentAdd migrations for webhook source_channel_id (diff)
downloadserver-ts-bb256650516dc4cb5b0912ed5d6c43aeb1da04ef.tar.xz
Merge pull request #1164 from DEVTomatoCake/fix/webhook-source-channel-migration
Add migrations for webhook source_channel_id
Diffstat (limited to 'src')
-rw-r--r--src/util/migration/mariadb/1723644478176-webhookSourceChannel.ts23
-rw-r--r--src/util/migration/mysql/1723644478176-webhookSourceChannel.ts23
-rw-r--r--src/util/migration/postgres/1723644478176-webhookSourceChannel.ts23
3 files changed, 69 insertions, 0 deletions
diff --git a/src/util/migration/mariadb/1723644478176-webhookSourceChannel.ts b/src/util/migration/mariadb/1723644478176-webhookSourceChannel.ts
new file mode 100644

index 000000000..ac2b1799b --- /dev/null +++ b/src/util/migration/mariadb/1723644478176-webhookSourceChannel.ts
@@ -0,0 +1,23 @@ +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 AFTER `source_guild_id`", + ); + 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 FOREIGN KEY `FK_d64f38834fa676f6caa4786ddd6`", + ); + await queryRunner.query( + "ALTER TABLE `webhooks` DROP COLUMN `source_channel_id`", + ); + } +} diff --git a/src/util/migration/mysql/1723644478176-webhookSourceChannel.ts b/src/util/migration/mysql/1723644478176-webhookSourceChannel.ts new file mode 100644
index 000000000..ac2b1799b --- /dev/null +++ b/src/util/migration/mysql/1723644478176-webhookSourceChannel.ts
@@ -0,0 +1,23 @@ +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 AFTER `source_guild_id`", + ); + 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 FOREIGN KEY `FK_d64f38834fa676f6caa4786ddd6`", + ); + await queryRunner.query( + "ALTER TABLE `webhooks` DROP COLUMN `source_channel_id`", + ); + } +} diff --git a/src/util/migration/postgres/1723644478176-webhookSourceChannel.ts b/src/util/migration/postgres/1723644478176-webhookSourceChannel.ts new file mode 100644
index 000000000..babcf488c --- /dev/null +++ b/src/util/migration/postgres/1723644478176-webhookSourceChannel.ts
@@ -0,0 +1,23 @@ +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 AFTER source_guild_id", + ); + 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", + ); + } +}