parent
d0cb571c40
commit
871fda173b
16 changed files with 102 additions and 70 deletions
@ -0,0 +1,43 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
up: async (queryInterface, Sequelize) => { |
||||||
|
await queryInterface.dropTable("Wallets", { cascade: true }); |
||||||
|
await queryInterface.createTable('Wallets', { |
||||||
|
id: { |
||||||
|
type: Sequelize.INTEGER, |
||||||
|
autoIncrement: true, |
||||||
|
primaryKey: true, |
||||||
|
allowNull: false, |
||||||
|
}, |
||||||
|
userId: { |
||||||
|
type: Sequelize.INTEGER, |
||||||
|
allowNull: false, |
||||||
|
references: { |
||||||
|
model: 'Users', |
||||||
|
key: 'id', |
||||||
|
}, |
||||||
|
onDelete: 'CASCADE',
|
||||||
|
}, |
||||||
|
balance: { |
||||||
|
type: Sequelize.INTEGER, |
||||||
|
allowNull: false, |
||||||
|
defaultValue: 0,
|
||||||
|
}, |
||||||
|
createdAt: { |
||||||
|
type: Sequelize.DATE, |
||||||
|
allowNull: false, |
||||||
|
defaultValue: Sequelize.fn('NOW'), |
||||||
|
}, |
||||||
|
updatedAt: { |
||||||
|
type: Sequelize.DATE, |
||||||
|
allowNull: false, |
||||||
|
defaultValue: Sequelize.fn('NOW'), |
||||||
|
}, |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
down: async (queryInterface, Sequelize) => { |
||||||
|
await queryInterface.dropTable('Wallets'); |
||||||
|
}, |
||||||
|
}; |
Loading…
Reference in new issue