umayr / potato

A very tiny utility to steal food.
MIT License
0 stars 1 forks source link

Cannot delete or update a parent row: a foreign key constraint fails. #15

Open umayr opened 9 years ago

umayr commented 9 years ago

I think, b39d074e52f8954b4d219ec7dcf2533a9c471915 broke something. Whenever I'm executing script second time I'm getting this:

$ ./src/index.js 

Requesting: https://eatoye.pk/karachi/delivery?&s=rating&Search_PageNo=0
Requesting: https://eatoye.pk/karachi/delivery?&s=rating&Search_PageNo=1
Requesting: https://eatoye.pk/karachi/delivery?&s=rating&Search_PageNo=2
Requesting: https://eatoye.pk/karachi/delivery?&s=rating&Search_PageNo=3
Unhandled rejection SequelizeDatabaseError: ER_ROW_IS_REFERENCED: Cannot delete or update a parent row: a foreign key constraint fails
    at Query.formatError (/Users/umayr/Development/Node/hungrilla/potato/node_modules/sequelize/lib/dialects/mysql/query.js:157:14)
    at Query._callback (/Users/umayr/Development/Node/hungrilla/potato/node_modules/sequelize/lib/dialects/mysql/query.js:35:21)
    at Query.Sequence.end (/Users/umayr/Development/Node/hungrilla/potato/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
    at Query.ErrorPacket (/Users/umayr/Development/Node/hungrilla/potato/node_modules/mysql/lib/protocol/sequences/Query.js:94:8)
    at Protocol._parsePacket (/Users/umayr/Development/Node/hungrilla/potato/node_modules/mysql/lib/protocol/Protocol.js:271:23)
    at Parser.write (/Users/umayr/Development/Node/hungrilla/potato/node_modules/mysql/lib/protocol/Parser.js:77:12)
    at Protocol.write (/Users/umayr/Development/Node/hungrilla/potato/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/Users/umayr/Development/Node/hungrilla/potato/node_modules/mysql/lib/Connection.js:96:28)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)
mohuk commented 9 years ago

The second time? hmm .. what do you suspect ? I think you are trying to rewrite to an association which is not allowed

umayr commented 9 years ago

I think its sync issue. We don't have a catch block for it.