Courses

Laravel 11 Multi-Tenancy: All You Need To Know

Making DB Structure Changes for Tenants

Summary of this lesson:
- Managing database schema changes for multiple tenant databases
- Using tenant-specific migration folders
- Running migrations across all tenant databases with tenants:migrate command

In this course, we have covered all the basic features and all the primary use cases for packages for multi-tenancy. Let's spend some time on advanced features or what else we can do after installing the stancl/tenancy package.

Based on the demo project, I will continue working on that for upcoming lessons and will introduce a few more features and show how it works in a bit advanced way.

In this lesson, what do you do if you want to add something to the database structure of tenants?

For example, you have a task CRUD, and every tenant has its own database, and you want to add a field there. Let's add a description column to the tasks.


The package adds tenant migrations into the database/migrations/tenant folder. Then, instead of running the Artisan command migrate, we must run the tenants:migrate command.

So, first...

The full lesson is only for Premium Members.
Want to access all 22 lessons of this course? (88 min read)

You also get:

  • 69 courses (majority in latest Laravel 11)
  • Premium tutorials
  • Access to repositories
  • Private Discord