How to avoid update_at change on migrations

Viewed 50

When running TypeORM migrations and altering the values of columns in a table, it causes the auto generated update_at column to update.

I'm trying to avoid this as this change is a migration and is "not really" a change to the row.

The way I run this kind of migrations now is:

await queryRunner.query(`
  UPDATE "table_name"
  SET "column_name"=value1
  WHERE "other_column"=value2
`)

The way I was able to avoid this behaviour is to change my migration to:

await queryRunner.query(`
  UPDATE "table_name"
  SET "column_name"=value1,
      "update_at"="update_at"
  WHERE "other_column"=value2
`)

The problem with this solution is that I can not force other developers to use this method aside from Code Review and I would much rather have it done as an infrastructure for all migrations in the system.

0 Answers
Related