Iāve been trying to replicate this, but havenāt been able to locally. Can I ask, please:
Which version of @datocms-cli youāre using? (I tried on 1.3.3 and it seems to work)
Was this the first time you generated a staging-copy and ran the migration generator? Or have you done this previously (and it worked)?
Is there more than one migration script in your repo? (./migrations/*.js)
Also, to help us troubleshoot, would you mind posting (or emailing support@datocms.com) with your project ID/URL so we can take a look and see if itās something specific to your schema? With your permission, Iād like to fork your staging environment into a copy and a fork of that (like datocms-support-staging-copy and datocms-support-staging-copy-forked-for-migration) and try to do a migration on that, to see if I can locate the issue more specifically.
Any specific information you can provide would help track this down. Sorry, I havenāt been able to replicate the issue locally with my tests yet.
At the least, could you please send us your project ID/URL (either here or via email) so we can take a look and see if thereās something in your particular schema thatās causing this issue?
Yes this was the first migration for staging-copy (we didnāt have a schema_migration model yet).
Unfortunately, weāve now applied the migration on our staging environment already, by removing the generated code that creates the schema_migration model.
So now, we can no longer reproduce this issue and we expect follow-up migrations to work.
This was the only migration script at the time in the ./migrations folder.
Do you think itās still useful if we share the project ID/URL?
After editing the generated code and applying the migration, our staging environment looks as expected.
I did want to report this as it looks like a bug.
Do you mind doing so, please? If itās OK with you, Iād like to clone your environment to new copies (so we donāt mess up your existing production/staging envs) and try to replicate this bug.
Iāve also requested the same of jay1. Hopefully, between the two, we can track down the actual bug here?
I did want to report this as it looks like a bug.
It sure sounds like one! But Iām having trouble replicating it with our example projects, so seeing the exact situation (i.e. your affected environments) could help us isolate the bug. Sorry for the hassle here!
If itās too much trouble, I understand⦠since you already fixed the issue on your end, please donāt feel like you have to jump through hoops to help us track it down. But if you do have time, it might help us catch and fix the bug once and for all, both for other users and for the next time you want to do a new migration
Weāve further stumbled upon some issues, and while I canāt fully articulate them, I can hopefully give some pointers.
Somehow, weāve ended up with a different recordID for the schema_migration models on staging and uat.
This is probably whatās causing the migration:new script to want to re-create the schema_migration model, even when it already exists.
I think we mixed updating our records by clicking in the web interface with creating them with migrations, and this is the root of whatās causing us major issues in using the migration tooling.
Thank you for sharing this! It sounds similar to jay1ās situation, where conflicting (human/UI) edits of the same model names causes the scripting to break.
Weāve filed a bug report about it internally, and will report back as soon as we have more information!