fauna-labs / fauna-schema-migrate

The Fauna Schema Migrate tool helps you set up Fauna resources as code and perform schema migrations.
MIT No Attribution
88 stars 11 forks source link

unbearably unreliable #79

Closed aprilmintacpineda closed 3 years ago

aprilmintacpineda commented 3 years ago

I'm doing migrations and I've run it several times but for some reason, it does not apply all migration BUT it will say successful, which means it's lying when your tools are lying you are bound to make PRODUCTION BUGS.

Recomendation:

Instead of displaying:

Fauna Schema Migrate - 2.1.2
---------------------------------------
--- Starting subtask Retrieving current cloud migration state
--- Finished subtask Retrieved current migration state
--------- Current cloud migrations----------
    2021-03-28T10:48:52.250Z
    2021-04-17T02:03:19.186Z
    2021-04-17T09:15:39.642Z
    2021-05-02T03:43:07.746Z
    2021-05-03T09:25:29.544Z
    2021-05-11T11:00:49.014Z
    2021-05-11T11:29:36.699Z
    2021-05-11T12:20:53.249Z
    2021-05-14T12:51:36.677Z
    2021-05-17T14:13:02.781Z
    2021-05-20T10:11:53.254Z
    2021-05-24T13:36:40.541Z
    2021-05-30T10:37:23.525Z
    2021-06-01T12:09:03.153Z
    2021-06-24T13:14:49.129Z
    2021-06-24T13:18:56.979Z
    2021-06-24T14:12:41.715Z
--------- Current local migrations ----------
    2021-03-28T10:48:52.250Z
    2021-04-17T02:03:19.186Z
    2021-04-17T09:15:39.642Z
    2021-05-02T03:43:07.746Z
    2021-05-03T09:25:29.544Z
    2021-05-11T11:00:49.014Z
    2021-05-11T11:29:36.699Z
    2021-05-11T12:20:53.249Z
    2021-05-14T12:51:36.677Z
    2021-05-17T14:13:02.781Z
    2021-05-20T10:11:53.254Z
    2021-05-24T13:36:40.541Z
    2021-05-30T10:37:23.525Z
    2021-06-01T12:09:03.153Z
    2021-06-24T13:14:49.129Z
    2021-06-24T13:18:56.979Z
    2021-06-24T14:12:41.715Z
    2021-06-26T08:11:49.383Z
    2021-06-26T09:20:33.769Z
    2021-06-26T09:28:01.452Z
    2021-06-26T09:36:35.561Z
    2021-06-26T09:45:39.930Z
--------- Task ----------
    apply 1 migrations

--- Starting subtask [ DB: ROOT ] Generate migration code
--- Finished subtask [ DB: ROOT ] Generated migration code
--- Starting subtask [ DB: ROOT ] Applying migration
--- Finished subtask Done applying migrations
Done in 2.19s.
  1. Display what migration was applied on the last run
  2. Display which migrations were applied on this run.
  3. Don't ignore error messages.
  4. Don't FAIL SILENTLY.
  5. Actually throw actionable error messages.

EDIT:

After about an hour of debugging why this is happening, I could not find the reason so I ended up giving up and needing to manually create the migrations documents and to manually run each migrations using the shell.

github-actions[bot] commented 3 years ago

Internal ticket number is LABS-20

rts-rob commented 3 years ago

Hi @aprilmintacpineda - sorry you're having this experience. FSM applies one migration at a time as a default, in order to prevent unexpected behavior.

This is why the tool output:

--------- Task ----------
    apply 1 migrations

You can also pass it the number of migrations to apply, or "all" to apply all outstanding migrations, e.g., npx @fauna-labs/fauna-schema-migrate apply all. Does that work for your case?

If you're looking for a tool that's more likely to go into production/supported status, I'd suggest you check out our Serverless Framework plugin and example of how to use it.

aprilmintacpineda commented 3 years ago

You can also pass it the number of migrations to apply, or "all" to apply all outstanding migrations, e.g., npx @fauna-labs/fauna-schema-migrate apply all. Does that work for your case?

I can't verify if this will work because I've already manually tried to migrate them all. However if that is true, then running it multiple times should do the trick BUT unfortunately, that didn't do it, that's why I had to manually do the work. I'll update my script to that and come back later when I can verify it...

rts-rob commented 3 years ago

Sounds good; thanks for the follow-up.

I'm going to close this for now. If it doesn't work for you, please re-open.