1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-05 10:22:31 +01:00

Merge pull request #1164 from DEVTomatoCake/fix/webhook-source-channel-migration

Add migrations for webhook source_channel_id
This commit is contained in:
Puyodead1 2024-08-14 10:51:56 -04:00 committed by GitHub
commit bb25665051
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 69 additions and 0 deletions

View File

@ -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`",
);
}
}

View File

@ -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`",
);
}
}

View File

@ -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",
);
}
}