-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migrations for webhook source_channel_id
- Loading branch information
1 parent
2f1449e
commit 7a726e7
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/util/migration/mariadb/1723644478176-webhookSourceChannel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`", | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/util/migration/mysql/1723644478176-webhookSourceChannel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`", | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/util/migration/postgres/1723644478176-webhookSourceChannel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
); | ||
} | ||
} |