sequelize-middleware/migrations/20200212092136-create-cars-...
2020-02-13 22:36:14 +01:00

40 lines
832 B
JavaScript

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");
}
};