30 lines
928 B
TypeScript
30 lines
928 B
TypeScript
|
|
import { Sequelize } from 'sequelize';
|
|
|
|
const sequelize = new Sequelize('royal_enfield_onboarding', 'laxman', '<.efvP1D0^80Z)r5', {
|
|
host: 'localhost',
|
|
dialect: 'postgres',
|
|
logging: console.log
|
|
});
|
|
|
|
const run = async () => {
|
|
try {
|
|
await sequelize.authenticate();
|
|
console.log('Connected to database.');
|
|
|
|
console.log('Renaming recommendation to decision and remarks to decisionRemarks in interview_evaluations...');
|
|
|
|
// Use a transaction for safety
|
|
await sequelize.query('ALTER TABLE "interview_evaluations" RENAME COLUMN "recommendation" TO "decision";');
|
|
await sequelize.query('ALTER TABLE "interview_evaluations" RENAME COLUMN "remarks" TO "decisionRemarks";');
|
|
|
|
console.log('Columns renamed successfully.');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('Error during migration:', error);
|
|
process.exit(1);
|
|
}
|
|
};
|
|
|
|
run();
|