-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add alert for trans bans org changes
- Loading branch information
1 parent
07b78c2
commit 228c73a
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
packages/db/prisma/data-migrations/2025-01-29_update-nationwide-locationbased-alert.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,51 @@ | ||
import { type MigrationJob } from '~db/prisma/dataMigrationRunner' | ||
import { type JobDef } from '~db/prisma/jobPreRun' | ||
|
||
/** Define the job metadata here. */ | ||
const jobDef: JobDef = { | ||
jobId: '2025-01-29_update-nationwide-locationbased-alert', | ||
title: 'change the location-based alert text string', | ||
createdBy: 'Diana', | ||
/** Optional: Longer description for the job */ | ||
description: 'change the location-based alert text string', | ||
} | ||
/** | ||
* Job export - this variable MUST be UNIQUE | ||
*/ | ||
export const job20250129_update_nationwide_locationbased_alert = { | ||
title: `[${jobDef.jobId}] ${jobDef.title}`, | ||
task: async (ctx, task) => { | ||
const { createLogger, formatMessage, jobPostRunner, prisma } = ctx | ||
/** Create logging instance */ | ||
createLogger(task, jobDef.jobId) | ||
const log = (...args: Parameters<typeof formatMessage>) => (task.output = formatMessage(...args)) | ||
|
||
// Variables for the update | ||
const key = 'locationBasedAlert.alrt_locationBasedAlert.alrt_01J5XNBQ5GREHSHK5D2QTCXRWE' | ||
const ns = 'org-data' | ||
const newTextValue = | ||
'Some organizations are adjusting services due to recent funding cuts and policy changes. Contact providers directly for updates.' | ||
|
||
// Perform the update | ||
const update1 = await prisma.translationKey.update({ | ||
where: { ns_key: { key, ns } }, | ||
data: { text: newTextValue }, | ||
}) | ||
|
||
const update2 = await prisma.locationAlert.update({ | ||
where: { id: 'alrt_01J1D1GAT5G5S6QNMCND5PMDAX' }, | ||
data: { level: 'WARN_SECONDARY' }, // update this to the correct id | ||
}) | ||
|
||
log(`Location-based alert text string updated: ${update1.key} with new text: "${update1.text}"`) | ||
log(`Location-based alert level type for anti-trans map: ${update2.key} change to: "${update2.text}"`) | ||
|
||
/** | ||
* DO NOT REMOVE BELOW | ||
* | ||
* This writes a record to the DB to register that this migration has run successfully. | ||
*/ | ||
await jobPostRunner(jobDef) | ||
}, | ||
def: jobDef, | ||
} satisfies MigrationJob |
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