-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm" | ||
|
||
export class AlignUpdatedAtOfCharts1726480222201 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
UPDATE chart_configs cf | ||
INNER JOIN charts c ON c.configId = cf.id | ||
SET cf.updatedAt = LEAST(cf.updatedAt, c.updatedAt) | ||
WHERE c.updatedAt IS NOT NULL; | ||
`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
Check warning on line 13 in db/migration/1726480222201-AlignUpdatedAtOfCharts.ts GitHub Actions / eslint
|
||
throw new Error( | ||
"Cannot automatically revert migration 'AlignUpdatedAtOfCharts1726480222201'" | ||
) | ||
} | ||
} |