Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds opt-in seeding #404

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DarkGhostHunter
Copy link

This adds the ability to seed the database.

Laravel can seed the database without confirmation when the application is not on production. By using this ability to confirm, the seeding can be enabled by setting AUTORUN_LARAVEL_SEED to either true or the class name of the Database Seeder.

This step runs after the migration step.

@chris0203
Copy link

This will not work in production. it got an error when APP_ENV=production

🚀 Running seeders...

                            APPLICATION IN PRODUCTION.                           

WARN  Command cancelled.

should change it to

php ${APP_BASE_DIR}/artisan db:seed --force

@DarkGhostHunter
Copy link
Author

This will not work in production. it got an error when APP_ENV=production

🚀 Running seeders...



                            APPLICATION IN PRODUCTION.                           



WARN  Command cancelled.

should change it to

php ${APP_BASE_DIR}/artisan db:seed --force

Shouldn't work on production. That's a feature. If you need seeding on production you have to do it manually.

@harrisonratcliffe
Copy link

Would really like to see this implemented @jaydrogers

@harrisonratcliffe
Copy link

This will not work in production. it got an error when APP_ENV=production

🚀 Running seeders...



                            APPLICATION IN PRODUCTION.                           



WARN  Command cancelled.

should change it to

php ${APP_BASE_DIR}/artisan db:seed --force

Shouldn't work on production. That's a feature. If you need seeding on production you have to do it manually.

Can add --force to get round that.

@DarkGhostHunter
Copy link
Author

I wouldn't. Rather, I would let the user create their own logic for seeding a production database.

This is because seeding is meant to fake records, and doing so in production can mix up real records.

This is great for staging or testing environments, tho, which is the main goal for this.

@jaydrogers
Copy link
Member

I see the use case for this now and I really like this. Let me evaluate this for v3.6 and I will keep you all posted 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants