Sails version: 1.0.2
Node version: 8.11.1
NPM version: 5.6.0
DB adapter name: mongo
Operating system: MAC OS high sierra 10.13.3
Hi,
When I upgrade my project from sails 0.12 -> 1.0.2, forget change config migrate from
'alter' to 'safe'.
So it start migrate when I lift, and then error came out like:
When attempting to perform the alter auto-migration strategy on model document, Sails encountered incompatible data. Some existing document record(s) couldn't be adjusted automatically to match your model definition. Usually, this is a result of recent edits to your model files; or (less often) due to incomplete inserts or modifications made directly to the database by hand.
Details:
Failed to reinsert migrated data. Could not use one of the provided new records: Could not use specified `associatedPage`. Expecting an id representing the associated record, or `null` to indicate there will be no associated record. But the specified value is not a valid `associatedPage`. Cannot use empty string ('') as a primary key value.
Some development data was recovered (see .tmp/automigration.document.4844.log). Any existing document records were deleted, but your data from OTHER models (including any relationships tracked in foreign keys and join tables) might still be intact. If you care about recovering any of that data, be sure to back it up now before you continue.
then my date was wiped, so I want try find the log file '.tmp/automigration.document.4844.log' to find data back, but can't find it in any where.
Is there any way I can find it?
Hi @LiuWei-Luke! It looks like you missed a step or two when you created your issue. Please edit your comment (use the pencil icon at the top-right corner of the comment box) and fix the following:
As soon as those items are rectified, post a new comment (e.g. “Ok, fixed!”) below and we'll take a look. Thanks!
*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]
Hi @LiuWei-Luke - I see you were running this project on a mac, did you have TimeMachine backup running before the upgrade? You may be able to recover any lost data with that or similar backup services, otherwise the data may be potentially changed/lost. Also check out the official Sails 1.x Upgrading doc for best practice if you haven't already, this covers important precautions and steps to take for upgrading. Hope this helps!
@LiuWei-Luke - Hey, I just reproduced this issue on my side as well and indeed the automigration log file in is not generated in the .tmp folder from this scenario. This does appear to be a bug at the moment.
Help welcome on this one- I remember vaguely seeing this before, and I think maybe it has to do with a regression due to something we did for fixing paths on windows
Hey just stopping by to say this bug is pretty brutal.
If you鈥檙e not going to fix this, you should at least update the console output to remove the message about the automigration file being written with the dumped data. It鈥檚 a really bad developer experience to go look for that file and find out it鈥檚 not there.
@lowe0292 you're right. On it.
Hey @lowe0292, we've updated the error message.
Most helpful comment
Hey just stopping by to say this bug is pretty brutal.
If you鈥檙e not going to fix this, you should at least update the console output to remove the message about the automigration file being written with the dumped data. It鈥檚 a really bad developer experience to go look for that file and find out it鈥檚 not there.