3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-19 07:20:00 +00:00
zeppelin/backend/src/migrations/1561111990357-CreateConfigsTable.ts

52 lines
1.2 KiB
TypeScript
Raw Normal View History

import { MigrationInterface, QueryRunner, Table, TableIndex } from "typeorm";
export class CreateConfigsTable1561111990357 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.createTable(
new Table({
name: "configs",
columns: [
{
name: "id",
type: "int",
isPrimary: true,
isGenerated: true,
generationStrategy: "increment",
},
{
name: "key",
type: "varchar",
length: "48",
},
{
name: "config",
type: "mediumtext",
},
{
name: "is_active",
type: "tinyint",
},
{
name: "edited_by",
type: "bigint",
},
{
name: "edited_at",
type: "datetime",
default: "now()",
},
],
indices: [
{
columnNames: ["key", "is_active"],
},
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.dropTable("configs", true);
}
}