25 lines
966 B
TypeScript
25 lines
966 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
export class AddPluginData1000000000008 implements MigrationInterface {
|
|
name = 'AddPluginData1000000000008';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
CREATE TABLE IF NOT EXISTS "plugin_data" (
|
|
"pluginId" TEXT NOT NULL,
|
|
"scope" TEXT NOT NULL,
|
|
"serverId" TEXT NOT NULL DEFAULT '',
|
|
"key" TEXT NOT NULL,
|
|
"valueJson" TEXT NOT NULL,
|
|
"updatedAt" INTEGER NOT NULL,
|
|
PRIMARY KEY ("pluginId", "scope", "serverId", "key")
|
|
)
|
|
`);
|
|
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "idx_plugin_data_plugin_scope" ON "plugin_data" ("pluginId", "scope")`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`DROP INDEX IF EXISTS "idx_plugin_data_plugin_scope"`);
|
|
await queryRunner.query(`DROP TABLE IF EXISTS "plugin_data"`);
|
|
}
|
|
} |