Untitled
unknown
plain_text
2 years ago
754 B
10
Indexable
// post_categories
module.exports = {
up: async (QueryInterface, Sequelize) => {
await QueryInterface.createTable('posts_categories', {
post_id: {
type: Sequelize.INTEGER,
primaryKey: true,
references: {
model: 'blog_posts',
key: 'id',
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
categoryId: {
field: 'category_id',
type: Sequelize.INTEGER,
primaryKey: true,
references: {
model: 'categories',
key: 'id',
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
});
},
down: async (QueryInterface, _Sequelize) => {
await QueryInterface.dropTable('posts_categories');
},
};Editor is loading...
Leave a Comment