Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Commit

Permalink
feat: 添加order表的migration
Browse files Browse the repository at this point in the history
  • Loading branch information
klren0312 committed May 5, 2020
1 parent 22bbfcd commit 015beb6
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions ApiServer/migrations/20200505023655-Order.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
'use strict';

module.exports = {
up: (queryInterface, Sequelize) => {
/*
Add altering commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.createTable('users', { id: Sequelize.INTEGER });
*/
const { FLOAT, INTEGER, STRING } = Sequelize
return queryInterface.createTable('order', {
id: {
type: INTEGER(11),
primaryKey: true,
allowNull: false,
autoIncrement: true
},
user_id: {
type: INTEGER,
allowNull: false
},
order_id: {
type: STRING,
unique: true,
allowNull: false
},
alipay_id: {
type: STRING,
allowNull: true
},
product: {
type: STRING,
allowNull: false
},
info: {
type: STRING,
allowNull: true
},
number: {
type: INTEGER,
allowNull: false
},
total_price: {
type: FLOAT,
allowNull: false
},
address: {
type: STRING,
allowNull: false
},
mobile: {
type: INTEGER,
allowNull: false
},
status: {
type: STRING,
allowNull: false
},
buyer_id: {
type: STRING,
allowNull: true
},
seller_id: {
type: STRING,
allowNull: true
}
})
},

down: (queryInterface, Sequelize) => {
/*
Add reverting commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.dropTable('users');
*/
return queryInterface.dropTable('order')
}
};

0 comments on commit 015beb6

Please sign in to comment.