mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-22 00:02:12 +02:00
NestJS notification microservice for email, push, Matrix, and webhook notifications across all ManaCore apps. Features: - Multi-channel delivery (email, push, Matrix, webhook) - Handlebars template engine with defaults - User notification preferences - BullMQ async job processing - Delivery tracking and logging - Prometheus metrics Includes @manacore/notify-client package for NestJS integration.
29 lines
703 B
TypeScript
29 lines
703 B
TypeScript
import { drizzle } from 'drizzle-orm/postgres-js';
|
|
import { migrate } from 'drizzle-orm/postgres-js/migrator';
|
|
import postgres from 'postgres';
|
|
|
|
async function runMigrations() {
|
|
const databaseUrl = process.env.DATABASE_URL;
|
|
|
|
if (!databaseUrl) {
|
|
console.error('DATABASE_URL environment variable is not set');
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log('Running migrations...');
|
|
|
|
const sql = postgres(databaseUrl, { max: 1 });
|
|
const db = drizzle(sql);
|
|
|
|
try {
|
|
await migrate(db, { migrationsFolder: './drizzle' });
|
|
console.log('Migrations completed successfully');
|
|
} catch (error) {
|
|
console.error('Migration failed:', error);
|
|
process.exit(1);
|
|
} finally {
|
|
await sql.end();
|
|
}
|
|
}
|
|
|
|
runMigrations();
|