bigweld86's avatar

Use a separate project only for migrations and reference it from other projects

Hello. I've got an e-commerce app which will be basically divided in 2 sections/projects:

  1. One section will be in charge of frontend/backend transactions. Frontend pages will be in Vue, backend in Laravel
  2. The other section will be basically an admin section, to manage (add/edit/delete) products, orders etc and will be completely build in laravel

Both projects will obviously query and modify the same database.

Here's my question:

Can I have a separate project just in charge of database migrations? if so, how could I reference those migrations for each of the projects (repositories)?

I don't want to have these functionality together (store itself and the admin part of it), that's why I want to separate them.

I don't think there's gonna be much code replication, I mean, I know there's gonna be some, at least for the login part but other than that (and a few other cases) not many.

Is there a way to accomplish this?

Thanks.

0 likes
3 replies
Sinnbeck's avatar

You can set a path when running migrations (you might need to use --realpath instead of --path)

php artisan migrate --path /var/www/foo/migrations
bigweld86's avatar

thanks @sinnbeck . Would be possible to strip completely the project and leave only the database (factories, migrations, seeds) folder?

Sinnbeck's avatar

I would imagine you get some issues creating new migration files as artisan most likely would break. My best suggestion is to just give it a try. Rename a folder and try creation a migration

Please or to participate in this conversation.