diff --git a/apps/app/public/locales/en/attribute.json b/apps/app/public/locales/en/attribute.json index b629066d21..3ab8c67676 100644 --- a/apps/app/public/locales/en/attribute.json +++ b/apps/app/public/locales/en/attribute.json @@ -73,6 +73,7 @@ "cost-accepts-insurance_withUrl": "This service accepts insurance. Click here to visit the organization's page for more information on cost, financial assistance options and insurance coverage details.", "cost-fees": "Incurs a cost", "cost-free": "Free of cost", + "cost-financial-assistance-available": "Financial assistance available", "cost-sliding-scale": "Costs determined on a sliding scale", "cost-sliding-scale_default": "This service has sliding scale fees. The amount you pay for services is adjusted according to your income level. Contact the organization directly for more information.", "cost-sliding-scale_withUrl": "This service has sliding scale fees. The amount you pay for services is adjusted according to your income level. Click here to visit the organization's page for more information." diff --git a/packages/db/prisma/data-migrations/2025-02-17_new-cost-attribute.ts b/packages/db/prisma/data-migrations/2025-02-17_new-cost-attribute.ts new file mode 100644 index 0000000000..df784b86a6 --- /dev/null +++ b/packages/db/prisma/data-migrations/2025-02-17_new-cost-attribute.ts @@ -0,0 +1,63 @@ +import { type MigrationJob } from '~db/prisma/dataMigrationRunner' +import { type JobDef } from '~db/prisma/jobPreRun' + +/** Define the job metadata here. */ +const jobDef: JobDef = { + jobId: '2025-02-17_new-cost-attribute', + title: 'new cost attribute', + createdBy: 'Diana Garbarino', + /** Optional: Longer description for the job */ + description: undefined, +} +/** + * Job export - this variable MUST be UNIQUE + */ +export const job20250217_new_cost_attribute = { + title: `[${jobDef.jobId}] ${jobDef.title}`, + task: async (ctx, task) => { + const { createLogger, downloadFromDatastore, generateId, formatMessage, jobPostRunner, prisma } = ctx + /** Create logging instance */ + createLogger(task, jobDef.jobId) + const log = (...args: Parameters) => (task.output = formatMessage(...args)) + /** + * Start defining your data migration from here. + * + * To log output, use `task.output = 'Message to log'` + * + * This will be written to `stdout` and to a log file in `/prisma/migration-logs/` + */ + + // Do stuff + + await prisma.$transaction(async (tx) => { + const financialAsst = await tx.attribute.create({ + data: { + id: 'attr_01J4044WXYZV6X8B3N2J7M5T9P', + tag: 'cost-financial-assistance-available', + name: 'Financial assistance available', + active: true, + canAttachTo: ['SERVICE'], + categories: { create: { categoryId: 'attc_01GW2HHFVFKNMYPN8F86M0H576' } }, + icon: 'carbon:piggy-bank', + key: { + create: { + key: 'cost.cost-financial-assistance-available', + text: 'Financial assistance available', + ns: 'attribute', + active: true, + }, + }, + }, + }) + log(`Created "${financialAsst.name}" (${financialAsst.id})`) + }) + + /** + * 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 diff --git a/packages/db/prisma/data-migrations/index.ts b/packages/db/prisma/data-migrations/index.ts index 79b4ee983c..62032eccab 100644 --- a/packages/db/prisma/data-migrations/index.ts +++ b/packages/db/prisma/data-migrations/index.ts @@ -23,5 +23,6 @@ export * from './2025-01-31_remove-twitter-from-orgWebsite-and-OrgSocialMedia' export * from './2025-01-31_remove-twitter-from-SocialMediaServices' export * from './2025-02-17_new_legal-service-tag' export * from './2025-02-17_new_mental-health-service-tag' +export * from './2025-02-17_new-cost-attribute' export * from './2025-02-17_update-medical-tags' // codegen:end