import { MigrationInterface, QueryRunner } from 'typeorm'; export class AddsBaseTriggers1775776542850 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(` CREATE OR REPLACE FUNCTION set_updated_at() RETURNS TRIGGER AS $$ BEGIN NEW.updated_at = now(); RETURN NEW; END; $$ LANGUAGE plpgsql; --end-sql`); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(`--sql DROP FUNCTION set_updated_at(); --end-sql`); } }