mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): non-nullable file metadata (#17598)
This commit is contained in:
parent
bd92748ddd
commit
c3d10c5be2
12 changed files with 49 additions and 66 deletions
|
|
@ -0,0 +1,22 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class MakeFileMetadataNonNullable1744662638410 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`DELETE FROM assets WHERE "fileCreatedAt" IS NULL OR "fileModifiedAt" IS NULL OR "localDateTime" IS NULL`,
|
||||
);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE assets
|
||||
ALTER COLUMN "fileCreatedAt" SET NOT NULL,
|
||||
ALTER COLUMN "fileModifiedAt" SET NOT NULL,
|
||||
ALTER COLUMN "localDateTime" SET NOT NULL`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE assets
|
||||
ALTER COLUMN "fileCreatedAt" DROP NOT NULL,
|
||||
ALTER COLUMN "fileModifiedAt" DROP NOT NULL,
|
||||
ALTER COLUMN "localDateTime" DROP NOT NULL`);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue