Skip to content

Commit eeb4531

Browse files
committed
Better handling of the new phaseChangeNotifications field (defaults to true for all imports)
1 parent b6c4649 commit eeb4531

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

migrator/prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ model Resource {
3434
memberId String
3535
memberHandle String
3636
roleId String
37+
phaseChangeNotifications Boolean @default(true)
3738
createdAt DateTime @default(now())
3839
createdBy String
3940
updatedAt DateTime? @updatedAt

migrator/src/migrators/migrateResource.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ async function migrateResource(filePath, startDate) {
5151
}
5252

5353
const createdBy = data.createdBy || process.env.CREATED_BY;
54-
const phaseChangeNotifications = Object.prototype.hasOwnProperty.call(data, 'phaseChangeNotifications')
55-
? data.phaseChangeNotifications
56-
: null;
54+
const phaseChangeNotifications = data.phaseChangeNotifications ?? true;
5755

5856
await prisma.resource.upsert({
5957
where: { id: data.id },

migrator/src/migrators/migrateResourceBatch.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ async function migrateResource(filePath, startDate) {
4646
const results = await Promise.allSettled(
4747
batch.map(data => {
4848
const createdBy = data.createdBy || process.env.CREATED_BY;
49-
const phaseChangeNotifications = Object.prototype.hasOwnProperty.call(data, 'phaseChangeNotifications')
50-
? data.phaseChangeNotifications
51-
: null;
49+
const phaseChangeNotifications = data.phaseChangeNotifications ?? true;
5250

5351
return prisma.resource.upsert({
5452
where: { id: data.id },

0 commit comments

Comments
 (0)