| 123456 |
- import {readFile} from 'node:fs/promises';
- export const launchMigrationFiles=['account-security.sql','payroll-integrity.sql','payroll-cutoff.sql','account-deletion.sql'];
- // A legacy standalone file has BEGIN/COMMIT. Remove only its top-level wrapper so
- // the publisher's transaction also protects the routines installed before/after it.
- export function withoutTransactionWrapper(source){return source.replace(/^(?:BEGIN|COMMIT);[ \t]*\r?$/gm,'');}
- export async function launchMigrationSql(){return (await Promise.all(launchMigrationFiles.map(name=>readFile(new URL('../sql/'+name,import.meta.url),'utf8')))).map(withoutTransactionWrapper).join('\n');}
|