mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
ready to test
Testing Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
// Wires up the bare product_id and category_id columns that were left
|
||||
// as plain integers in migration 000008.
|
||||
module.exports = {
|
||||
async up(queryInterface) {
|
||||
await queryInterface.addConstraint('course_products', {
|
||||
fields: ['product_id'],
|
||||
type: 'foreign key',
|
||||
name: 'fk_course_products_product_id',
|
||||
references: { table: 'products', field: 'id' },
|
||||
onDelete: 'CASCADE',
|
||||
});
|
||||
|
||||
await queryInterface.addConstraint('course_product_categories', {
|
||||
fields: ['category_id'],
|
||||
type: 'foreign key',
|
||||
name: 'fk_course_product_categories_category_id',
|
||||
references: { table: 'categories', field: 'id' },
|
||||
onDelete: 'CASCADE',
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
await queryInterface.removeConstraint('course_products', 'fk_course_products_product_id');
|
||||
await queryInterface.removeConstraint('course_product_categories', 'fk_course_product_categories_category_id');
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user