Files
robinnetwork_website_server/src/migrations/1763476513917-add-fields-to-blogs.ts
2026-02-19 16:19:43 +03:30

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