Wappler Version : 3.9.4
Operating System : W10
Server Model: Node
Database Type: Mysql
Hosting Type: node / docker
Expected behavior
What do you think should happen?
Seed should remove current database records and replace with the ones in the seed.
Actual behavior
What actually happens?
Error occurs: cannot delete or update a parent row: a foreign key constraint fails.
How to reproduce
- Create seed of a table. tick the ‘delete records’ box
- Apply seed immediately
Extra info:
Knex file looks like this:
exports.seed = function(knex) {
// Deletes ALL existing entries
return knex('smart_courses.courses').del()
.then(function () {
// Inserts seed entries
return knex('smart_courses.courses').insert([
{
"teacher": 34,
"course_title": "The pain and the prize",
"course_description": "What you gain and what you lose",
"course_length": "5",
"course_cover_image": "assets/course_cover_images/pain-prize-bg.jpg",
"created_at": "2021-04-07T09:44:36.000Z",
"updated_at": "2021-04-07T09:44:36.000Z",
"school": null
}, CONTINUED...
The table looks like this:
There are references to this table in these tables: