Add card and character tables

This commit is contained in:
2022-04-17 19:38:50 +02:00
parent 0419733925
commit 9f568dbbdb
5 changed files with 153 additions and 1 deletions

View File

@@ -0,0 +1,48 @@
'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('Cards', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
identifier: {
allowNull: false,
type: Sequelize.STRING
},
characterID: {
allowNull: false,
type: Sequelize.INTEGER,
references: {
model: 'Characters',
key: 'id'
}
},
ownerID: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'Users',
key: 'id'
}
},
enabled: {
allowNull: false,
type: Sequelize.BOOLEAN
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('Cards');
}
};