40 lines
832 B
JavaScript
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");
|
||
|
}
|
||
|
};
|