Laravel

Migrations

Migrations are like version control for your database, allowing your team to define and share the applications database schema definition. If you have ever had to tell a teammate to manually add a column to their local database schema after pulling in your changes from source control, youve faced the problem that database migrations solve.

All migration files & changes to the database SHOULD be updated in the migration files. Migrations are a 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.

The database view and procedures etc needs to be in the migrations of the system aswell.

Ream More:

https://laravel.com/docs/12.x/migrations

Copyright © 2026