TheOchulus/convertDatabase.js

26 lines
659 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',
'status',
{
type: DataTypes.ENUM('planning', 'playing', 'beat'),
allowNull: false,
defaultValue: 'beat',
},
);
console.log('New column added successfully');
} catch (error) {
console.error('Error adding new column:', error);
} finally {
sequelize.sync();
}
})();