fix: default options, integration_types and contexts to empty array
This commit is contained in:
parent
d1cc40ff4b
commit
fecf3085e8
@ -53,7 +53,7 @@ export class ApplicationCommand extends BaseClass {
|
|||||||
@Column({ nullable: true, type: "simple-json" })
|
@Column({ nullable: true, type: "simple-json" })
|
||||||
description_localizations?: Record<string, string>;
|
description_localizations?: Record<string, string>;
|
||||||
|
|
||||||
@Column({ nullable: true, type: "simple-json" })
|
@Column({ type: "simple-json", default: [] })
|
||||||
options?: ApplicationCommandOption[];
|
options?: ApplicationCommandOption[];
|
||||||
|
|
||||||
@Column({ nullable: true, type: String })
|
@Column({ nullable: true, type: String })
|
||||||
@ -71,13 +71,13 @@ export class ApplicationCommand extends BaseClass {
|
|||||||
@Column({ default: false })
|
@Column({ default: false })
|
||||||
nsfw?: boolean;
|
nsfw?: boolean;
|
||||||
|
|
||||||
@Column({ nullable: true, type: "simple-json" })
|
@Column({ type: "simple-json", default: [] })
|
||||||
integration_types?: ApplicationIntegrationType[];
|
integration_types?: ApplicationIntegrationType[];
|
||||||
|
|
||||||
@Column({ default: 0 })
|
@Column({ default: 0 })
|
||||||
global_popularity_rank?: number;
|
global_popularity_rank?: number;
|
||||||
|
|
||||||
@Column({ nullable: true, type: "simple-json" })
|
@Column({ type: "simple-json", default: [] })
|
||||||
contexts?: InteractionContextType[];
|
contexts?: InteractionContextType[];
|
||||||
|
|
||||||
@Column({ default: 0 })
|
@Column({ default: 0 })
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class ApplicationCommandsArraysNotNullable1761203098404 implements MigrationInterface {
|
||||||
|
name = "ApplicationCommandsArraysNotNullable1761203098404";
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`UPDATE "application_commands" SET options = '[]' WHERE options IS NULL`);
|
||||||
|
await queryRunner.query(`UPDATE "application_commands" SET integration_types = '[]' WHERE integration_types IS NULL`);
|
||||||
|
await queryRunner.query(`UPDATE "application_commands" SET contexts = '[]' WHERE contexts IS NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "options" SET NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "options" SET DEFAULT '[]'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "integration_types" SET NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "integration_types" SET DEFAULT '[]'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "contexts" SET NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "contexts" SET DEFAULT '[]'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "contexts" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "contexts" DROP NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "integration_types" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "integration_types" DROP NOT NULL`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "options" DROP DEFAULT`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "options" DROP NOT NULL`);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user