Compare commits
2 Commits
152a2c2fd1
...
d2893d6d2e
Author | SHA1 | Date |
---|---|---|
baz | d2893d6d2e | |
baz | 62af00b8d0 |
|
@ -0,0 +1,26 @@
|
|||
const { Sequelize, DataTypes } = require('sequelize');
|
||||
require('./dbObjects.js');
|
||||
const { sequelize, BeatenGames } = require ('./dbObjects.js');
|
||||
|
||||
// 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();
|
||||
}
|
||||
})();
|
|
@ -44,4 +44,4 @@ sequelize.sync({ alter: true })
|
|||
console.log(err);
|
||||
});
|
||||
|
||||
module.exports = { Users, Games, BeatenGames };
|
||||
module.exports = { sequelize, Users, Games, BeatenGames };
|
|
@ -1,5 +1,9 @@
|
|||
module.exports = (sequelize, DataTypes) => {
|
||||
return sequelize.define('beatenGames', {
|
||||
status: {
|
||||
type: DataTypes.ENUM('planning', 'playing', 'beat'),
|
||||
allowNull: true,
|
||||
},
|
||||
}, {
|
||||
timestamps: true,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue