EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
add_customer_status.js
Go to the documentation of this file.
1// Migration script placed inside backend so it can reuse backend's node_modules and dotenv
2const pool = require('../services/db');
3
4(async function run(){
5 try {
6 console.log('Running backend migration: add status column to customers');
7 const sql = "ALTER TABLE customers ADD COLUMN IF NOT EXISTS status VARCHAR(50) DEFAULT 'active';";
8 await pool.query(sql);
9 console.log('Migration applied successfully');
10 } catch (err) {
11 console.error('Migration failed:', err);
12 process.exitCode = 1;
13 } finally {
14 try { await pool.end(); } catch(e){}
15 }
16})();