41 lines
827 B
JavaScript
41 lines
827 B
JavaScript
|
module.exports = {
|
||
|
up: (queryInterface, Sequelize) => {
|
||
|
return queryInterface.createTable("Cars", {
|
||
|
id: {
|
||
|
allowNull: false,
|
||
|
autoIncrement: true,
|
||
|
primaryKey: true,
|
||
|
type: Sequelize.INTEGER
|
||
|
},
|
||
|
name: {
|
||
|
type: Sequelize.STRING
|
||
|
},
|
||
|
year: {
|
||
|
type: Sequelize.INTEGER
|
||
|
},
|
||
|
active: {
|
||
|
type: Sequelize.BOOLEAN
|
||
|
},
|
||
|
brandId: {
|
||
|
type: Sequelize.INTEGER,
|
||
|
allowNull: true,
|
||
|
references: {
|
||
|
model: "Brands",
|
||
|
key: "id"
|
||
|
}
|
||
|
},
|
||
|
createdAt: {
|
||
|
allowNull: false,
|
||
|
type: Sequelize.DATE
|
||
|
},
|
||
|
updatedAt: {
|
||
|
allowNull: false,
|
||
|
type: Sequelize.DATE
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
down: queryInterface => {
|
||
|
return queryInterface.dropTable("Cars");
|
||
|
}
|
||
|
};
|