-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(interactions): fix interactions last updated date
- Loading branch information
Showing
20 changed files
with
380 additions
and
224 deletions.
There are no files selected for viewing
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
Binary file not shown.
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
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
40 changes: 40 additions & 0 deletions
40
packages/backend/src/_migrations/1709572023866-auto-migration.ts
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,40 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { appLogger } from "../util"; | ||
import { domifaConfig } from "../config"; | ||
|
||
export class AutoMigration1709572023866 implements MigrationInterface { | ||
name = "AutoMigration1709572023866"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
if ( | ||
domifaConfig().envId === "prod" || | ||
domifaConfig().envId === "preprod" || | ||
domifaConfig().envId === "local" | ||
) { | ||
appLogger.warn( | ||
"[MIGRATION] add false by default to interactions procuration and returnToSender" | ||
); | ||
await queryRunner.query( | ||
`update interactions set "procuration" = false, "returnToSender" = false where procuration is null and "returnToSender" is null;` | ||
); | ||
await queryRunner.query( | ||
`update interactions set "returnToSender" = false where "returnToSender" is null;` | ||
); | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "interactions" ALTER COLUMN "returnToSender" DROP DEFAULT` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "interactions" ALTER COLUMN "returnToSender" DROP NOT NULL` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "interactions" ALTER COLUMN "procuration" DROP DEFAULT` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "interactions" ALTER COLUMN "procuration" DROP NOT NULL` | ||
); | ||
} | ||
} |
Oops, something went wrong.