sequelize-middleware/migrations/20200212092136-create-cars-colors.js

40 lines
832 B
JavaScript
Raw Normal View History

2020-02-13 22:36:14 +01:00
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable("CarsColors", {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
CarId: {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: "Cars",
key: "id"
}
},
ColorId: {
type: Sequelize.INTEGER,
allowNull: true,
references: {
model: "Colors",
key: "id"
}
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: queryInterface => {
return queryInterface.dropTable("CarsColors");
}
};