18 lines
753 B
TypeScript
18 lines
753 B
TypeScript
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
|
|
|
export class AddFieldsToBlogs1763476513917 implements MigrationInterface {
|
|
name = "AddFieldsToBlogs1763476513917";
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.addColumns("blogs", [
|
|
new TableColumn({ name: "featuredImage", type: "varchar", isNullable: true }),
|
|
new TableColumn({ name: "gallery", type: "jsonb", isNullable: true, default: "'[]'::jsonb" }),
|
|
new TableColumn({ name: "publishedAt", type: "timestamp", isNullable: true, default: null }),
|
|
]);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.dropColumns("blogs", ["featuredImage", "gallery", "publishedAt"]);
|
|
}
|
|
}
|