migration
This commit is contained in:
@@ -13,5 +13,6 @@ export default new DataSource({
|
||||
database: process.env.DB_NAME,
|
||||
entities: [join(__dirname, '../**/*.entity.{js,ts}')],
|
||||
migrations: [join(__dirname, '/migrations/*.{js,ts}')],
|
||||
migrationsTransactionMode: 'each',
|
||||
...(isCompiled ? {} : { requireTsNode: true }),
|
||||
});
|
||||
|
||||
@@ -15,9 +15,11 @@ const NEW_NOTIFICATION_KEYS = [NotificationScenarioKey.DEPOSIT_RECEIPT_SUBMITTED
|
||||
* Only adds the new enum values. Postgres forbids using a newly added enum
|
||||
* value in the same transaction it was created in, so seeding the actual
|
||||
* scenario rows is handled by the follow-up `SeedDepositScenarios` migration.
|
||||
* `transaction = false` commits ADD VALUE immediately (required by Postgres).
|
||||
*/
|
||||
export class AddDepositScenarios1722000000000 implements MigrationInterface {
|
||||
name = 'AddDepositScenarios1722000000000';
|
||||
transaction = false;
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
for (const key of NEW_SMS_KEYS) {
|
||||
|
||||
@@ -15,5 +15,8 @@ export function getTypeOrmOptions(): TypeOrmModuleOptions {
|
||||
// by both reserves and reserve_status_history). Use migrations instead.
|
||||
synchronize: false,
|
||||
migrationsRun: true,
|
||||
// Each migration commits separately so Postgres enum ADD VALUE can be
|
||||
// used by a follow-up seed migration (unsafe in the same transaction).
|
||||
migrationsTransactionMode: 'each',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user