This commit is contained in:
14
scripts/migrate-auth-catalog.ts
Normal file
14
scripts/migrate-auth-catalog.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import postgres from 'postgres';
|
||||
if (!process.env.DB_URL) throw new Error('DB_URL is required');
|
||||
const sql = postgres(process.env.DB_URL, { max: 1 });
|
||||
try {
|
||||
await sql.begin(async (tx) => {
|
||||
await tx.unsafe(
|
||||
await readFile(new URL('./auth-catalog-migration.sql', import.meta.url), 'utf8')
|
||||
);
|
||||
});
|
||||
console.log('Authentication and catalog migration applied');
|
||||
} finally {
|
||||
await sql.end();
|
||||
}
|
||||
Reference in New Issue
Block a user