Initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const { Pool } = require('pg');
|
||||
require('dotenv').config();
|
||||
|
||||
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
||||
|
||||
async function updateDB() {
|
||||
try {
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS h1_registers (
|
||||
id VARCHAR(50) PRIMARY KEY,
|
||||
dispensing_id VARCHAR(50) REFERENCES dispensing_records(id),
|
||||
patient_name VARCHAR(255) NOT NULL,
|
||||
prescriber_name VARCHAR(255),
|
||||
drug_name VARCHAR(255) NOT NULL,
|
||||
batch_no VARCHAR(100) NOT NULL,
|
||||
qty INTEGER NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
ALTER TABLE products ADD COLUMN IF NOT EXISTS hsn_code VARCHAR(20);
|
||||
UPDATE products SET dpco_ceiling = 80.00 WHERE id = 'prd_4410';
|
||||
UPDATE products SET dpco_ceiling = 120.00 WHERE id = 'prd_5510';
|
||||
`);
|
||||
console.log('Schema updated successfully');
|
||||
} catch (err) {
|
||||
console.error('Error:', err);
|
||||
} finally {
|
||||
pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
updateDB();
|
||||
Reference in New Issue
Block a user