27 lines
692 B
TypeScript
27 lines
692 B
TypeScript
|
|
import { Sequelize } from 'sequelize';
|
|
|
|
const sequelize = new Sequelize('royal_enfield_onboarding', 'laxman', 'Admin@123', {
|
|
host: 'localhost',
|
|
dialect: 'postgres',
|
|
logging: console.log
|
|
});
|
|
|
|
const run = async () => {
|
|
try {
|
|
await sequelize.authenticate();
|
|
console.log('Connected to database.');
|
|
|
|
console.log('Adding asmCode column to area_managers table...');
|
|
await sequelize.query('ALTER TABLE "area_managers" ADD COLUMN IF NOT EXISTS "asmCode" VARCHAR(255);');
|
|
|
|
console.log('Column added successfully.');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
process.exit(1);
|
|
}
|
|
};
|
|
|
|
run();
|