Search code examples
migrationcommitgitignorenomachine-nx

Should you commit Nx's migrations.json file?


I've used the nx migrate command that generated a migrations.json file at the root of my project. I've ran the migrations and they were successful.

I've committed the changes done by the migration and now considering if there's a point in keeping the migrations.json file, as its changes are already applied and committed.

I'm thinking of removing the file from the repo or even gitignoring it. Will removing the file affect future migrations in any way?


Solution

  • Yes, do remove this file. After the migrations have been run, nx no longer needs migrations.json.

    It says so in step 3 of the migrations docs, https://nx.dev/using-nx/updating-nx#step-3-cleaning-up

    Step 3: Cleaning up

    After you run all the migrations, you can remove migrations.json and commit any outstanding changes.