Migrations

All migration files & changes to the database SHOULD be updated in the migration files. Migrations are also crucial part in the automated testing for the system.

Up

Write up methods for deploying and automatic changes to the database.

Down

Write down() methods because:

  • it should be possible to rollback failed releases
  • developer experience: simplify switching between branches

Procedures & Views

Keep all querie, (elequent or raw queries) in the repositories of the relevant module. Do NOT create database views or stored procedures for functionality in the database layer. This makes it very difficult to trouble shoot and created magic in the system. When you need to modify it you also need access to the databases, when if this was in code you can just modify it and deploy.

When you really need to create a database view and you are certain that this will be the best option, please chat to a team lead. Defenitly for reporting purposes it is beneficial.

Table of Contents