Resetting DB & Seed artisan migrate:fresh --seed ... with Wave?

chrisd

Oct 17th, 2024 02:49 PM

Hi, I'd like to know if I can reset the DB & Seed artisan migrate:fresh --seed ... while working on an app with Wave?

Ideally: I can just run a single CLI command. This could ba a .bat file, or a custom artisan command.

The resultI want

  • Have a DB reset with my seed data; Where I usually run (pa migrate:fresh --seed)
  • An admin user
  • A subscriber
  • Be able to login with either user, right after running a CLI command
  • Wave things I have setup still be there (voyager, tables, breads, permissions, pages, etc.)

Do you have any ideas of how I can do this?

PS: I just thought of something... I could do a migrate:rollback and count the steps based on my own migrations. This is not ideal.

bobbyiliev

Oct 18th, 2024 08:17 AM

Hey!

One option here would be to use the same approach as with a standard Laravel app and create seeders for the things that you need.

For example, for the admin user, you already have that:

database/seeders/UsersTableSeeder.php

For the subscriber user, you can extend that seeder and add another user with a different role.

You should be able to login as normal after the refresh with both users.

Any additional information that you might need like some pages, or permissions can still be created using a seeder.

Things might get tricky around the BREADs as you might be changing those quite a bit depending on your exact needs. One option here is to use this iseed package here from this discussion here

https://github.com/orangehill/iseed

I've not personally used it but it seems like it would do exactly what you need it to do.

- Bobby

chrisd

Oct 22nd, 2024 11:02 PM

Okay it means I can never run a database reset and seed.

I can only do what I've said, where I roll back only a few steps, otherwise from my understanding is that anything I've done in Voyager BREAD setup will be wiped.

Using iseed, I could create some sort of snapshot to reseed everything at this point, but then would have to keep doing that if I make any more changes.

I feel like Wave Voyager is similar to WordPress development. Once starting, there's no going back to rebuilding the DB.

bobbyiliev

Oct 23rd, 2024 01:36 AM

Hi there,

I feel like Wave Voyager is similar to WordPress development. Once starting, there's no going back to rebuilding the DB.

This is one of the main reasons we are moving away from Voyager in Wave v3 in favour of Fillament!

- Bobby

Report
1