TheOchulus/convertDatabase.js

25 lines
604 B
JavaScript
Raw Normal View History

2024-02-11 18:37:16 +01:00
const { Sequelize, DataTypes } = require('sequelize');
require('./dbObjects.js');
2024-02-11 20:19:43 +01:00
const { sequelize, LoggedGames } = require ('./dbObjects.js');
2024-02-11 18:37:16 +01:00
// Add a new column to the existing table
(async () => {
try {
await sequelize.sync();
await sequelize.getQueryInterface().addColumn(
'BeatenGames',
'statusLastChanged',
2024-02-11 18:37:16 +01:00
{
type: DataTypes.DATE,
allowNull: true,
2024-02-11 18:37:16 +01:00
},
);
console.log('New column added successfully');
} catch (error) {
console.error('Error adding new column:', error);
} finally {
sequelize.sync();
}
})();