ToolJet/server/migrations/1709794417386-AddUpdatedAtColumnToLayouts.ts
Arpit 6249227022
Add updatedAt column to layouts table (#9026)
adds a new column named updatedAt to the layouts table in the database. The column has a default value of CURRENT_TIMESTAMP, which automatically sets the timestamp to the current date and time when a new row is inserted.

This change enables us to track the last update time of each layout entry, which is essential for various functionalities such as querying the latest versions of layouts and implementing dynamic component rendering based on the most recent updates.

The migration script responsible for adding the updatedAt column has been executed successfully, and the column has been verified to exist in the layouts table.
2024-04-19 13:05:08 +05:30

11 lines
470 B
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddUpdatedAtColumnToLayouts1709794417386 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query('ALTER TABLE layouts ADD COLUMN "updated_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP');
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query('ALTER TABLE layouts DROP COLUMN "updated_at"');
}
}