fix email issues, add company,project,todos
This commit is contained in:
32
run-migration.js
Normal file
32
run-migration.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import pkg from 'pg';
|
||||
const { Pool } = pkg;
|
||||
import dotenv from 'dotenv';
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const pool = new Pool({
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT || '5432'),
|
||||
user: process.env.DB_USER || 'admin',
|
||||
password: process.env.DB_PASSWORD || 'heslo123',
|
||||
database: process.env.DB_NAME || 'crm',
|
||||
});
|
||||
|
||||
async function runMigration() {
|
||||
console.log('⏳ Running project_users migration...');
|
||||
|
||||
try {
|
||||
const sql = readFileSync('./src/db/migrations/add_project_users.sql', 'utf8');
|
||||
await pool.query(sql);
|
||||
console.log('✅ Migration completed successfully');
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('❌ Migration failed:', error.message);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
runMigration();
|
||||
Reference in New Issue
Block a user