is there anyway to use cursor in sequelize migration
? i am trying to create DML script ,the idea is to loop the values in table ie. day using cursor and then insert values to other table ie. mealday inside the cursor.
table : day
dayId
dayName
table : meal
mealId
mealName
table : mealday
mealdayId
dayId
mealId
the insert statement i should use inside cursor is :
insert into mealday (dayId,mealId)
select **dayIdFromCursor**,mealId from meal
as a work around i can simply repeat the insert
statement 7 times (number of days in day table) and hard code dayId
insert into mealday (dayId,mealId)
select 1,mealId from meal
insert into mealday (dayId,mealId)
select 2,mealId from meal
...
insert into mealday (dayId,mealId)
select 7,mealId from meal
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.