Search code examples
elixirphoenix-frameworkecto

Is it good practice to use migration files in Phoenix Framework?


Scenario:

  1. set up an empty PostgreSQL instance
  2. set up tables, foreign keys, etc in Elixir only using migration files.

is this considered good practice in Elixir world?


Solution

  • Yes, it is good practice.

    With migrations you can always rollback database changes and also you keep database changes in version control so you can always see when and who changed the database structure.

    Having migrations you can also keep in sync with all of the developers on your team so if you create a migration, the next person that pulls the latest code just simply migrate the latest version of the database and now everyone is in sync, without having to pass around DB dumps.