parent
6945420e27
commit
716c4a6782
5 changed files with 117 additions and 7 deletions
@ -0,0 +1,65 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
up: async (queryInterface, Sequelize) => { |
||||||
|
await queryInterface.createTable('Products', { |
||||||
|
id: { |
||||||
|
type: Sequelize.INTEGER, |
||||||
|
allowNull: false, |
||||||
|
autoIncrement: true, |
||||||
|
primaryKey: true, |
||||||
|
}, |
||||||
|
name: { |
||||||
|
type: Sequelize.STRING, |
||||||
|
allowNull: false, |
||||||
|
}, |
||||||
|
description: { |
||||||
|
type: Sequelize.STRING, |
||||||
|
allowNull: false, |
||||||
|
}, |
||||||
|
price: { |
||||||
|
type: Sequelize.DECIMAL(10, 2), |
||||||
|
allowNull: false, |
||||||
|
}, |
||||||
|
imageUrl: { |
||||||
|
type: Sequelize.STRING, |
||||||
|
allowNull: true, |
||||||
|
}, |
||||||
|
tags: { |
||||||
|
type: Sequelize.ARRAY(Sequelize.STRING), |
||||||
|
allowNull: true, |
||||||
|
}, |
||||||
|
quantity: { |
||||||
|
type: Sequelize.INTEGER, |
||||||
|
allowNull: false, |
||||||
|
defaultValue: 0, |
||||||
|
}, |
||||||
|
brand: { |
||||||
|
type: Sequelize.STRING, |
||||||
|
allowNull: true, |
||||||
|
}, |
||||||
|
color: { |
||||||
|
type: Sequelize.STRING, |
||||||
|
allowNull: true, |
||||||
|
}, |
||||||
|
category: { |
||||||
|
type: Sequelize.STRING, |
||||||
|
allowNull: false, |
||||||
|
}, |
||||||
|
createdAt: { |
||||||
|
type: Sequelize.DATE, |
||||||
|
allowNull: false, |
||||||
|
defaultValue: Sequelize.NOW, |
||||||
|
}, |
||||||
|
updatedAt: { |
||||||
|
type: Sequelize.DATE, |
||||||
|
allowNull: false, |
||||||
|
defaultValue: Sequelize.NOW, |
||||||
|
}, |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
down: async (queryInterface, Sequelize) => { |
||||||
|
await queryInterface.dropTable('Products'); |
||||||
|
}, |
||||||
|
}; |
Loading…
Reference in new issue