feat: implement core dispensing, identity, and integration modules with authentication middleware
This commit is contained in:
+9
-3
@@ -1,18 +1,24 @@
|
||||
const { Pool } = require('pg');
|
||||
require('dotenv').config();
|
||||
|
||||
const pool = new Pool({
|
||||
connectionString: 'postgres://postgres:csh%402018@localhost:5432/ai_pharmacy'
|
||||
connectionString: process.env.DATABASE_URL || 'postgres://postgres:csh%402018@localhost:5433/ai_pharmacy'
|
||||
});
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
await pool.query('ALTER TABLE stock_movements ADD COLUMN IF NOT EXISTS reason_code VARCHAR(100)');
|
||||
await pool.query('ALTER TABLE stock_movements ADD COLUMN IF NOT EXISTS notes TEXT');
|
||||
console.log('Successfully added columns.');
|
||||
await pool.query('ALTER TABLE products ADD COLUMN IF NOT EXISTS hsn_code VARCHAR(20)');
|
||||
await pool.query('ALTER TABLE products ADD COLUMN IF NOT EXISTS tenant_id VARCHAR(50)');
|
||||
await pool.query('ALTER TABLE drugs ADD COLUMN IF NOT EXISTS tenant_id VARCHAR(50)');
|
||||
console.log('Successfully added missing database columns.');
|
||||
} catch (err) {
|
||||
console.error('Error:', err);
|
||||
console.error('Error altering database:', err);
|
||||
} finally {
|
||||
pool.end();
|
||||
}
|
||||
}
|
||||
run();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user