Trade: Add tradehistories table

and create rows at the end of each trade.
Both users traded cards are logged.
This commit is contained in:
2023-01-12 14:43:06 +01:00
parent 2ef1dfe7a7
commit 692904d462
3 changed files with 72 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('TradeHistories', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userAId: {
type: Sequelize.INTEGER
},
userBId: {
type: Sequelize.INTEGER
},
userATraded: {
type: Sequelize.JSON
},
userBTraded: {
type: Sequelize.JSON
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('TradeHistories');
}
};