Escape column names

This commit is contained in:
Iván Ovejero 2024-09-19 12:02:31 +02:00
parent ac1e781fb1
commit ea731a9485
No known key found for this signature in database

View file

@ -13,9 +13,11 @@ export class SeparateExecutionCreationFromStart1726218295879 implements Reversib
await dropNotNull('execution_entity', 'startedAt');
const executionEntity = escape.tableName('execution_entity');
const createdAt = escape.columnName('createdAt');
const startedAt = escape.columnName('startedAt');
// inaccurate for pre-migration rows but prevents `createdAt` from being nullable
await runQuery(`UPDATE ${executionEntity} SET createdAt = startedAt;`);
await runQuery(`UPDATE ${executionEntity} SET ${createdAt} = ${startedAt};`);
}
async down({ schemaBuilder: { dropColumns, addNotNull } }: MigrationContext) {