This PR creates a command to generate JSON seeder files from the production database so maintainers and contributors can seed their local database with up-to-date content.
Usage
The command to generate/update the JSON seeder files is as follows:
The --all option can be used to sync all content tables from production and automatically override the contents of any existing seeder files during the update. When this option is omitted, users can choose which data they'd like to sync:
The --override option can be used to automatically override the contents of any existing seeder files when updating a single table. Otherwise, the user will need to confirm this action during the update:
With the seeder files in place, users should run the following command to update their local development data:
php artisan migrate:fresh --seed
Implementation
For now, maintainers should periodically run the command to update the seeder files and commit those changes to the repo. This can especially be done when new resources etc are added to the production site via Nova.
Maintainer Note: Be sure to set the following env variables to connect to the Forge server where Onramp is hosted
TUNNELER_USER=
TUNNELER_HOSTNAME=
TUNNELER_PORT=
Future Improvements
To eliminate the need for manually updating these files, we should implement running a scheduled command that regenerates the seeder files for us and commits those changes from the server (h/t @darkboywonder). When this happens we should:
Remove the stechstudio/laravel-ssh-tunnel package used to create an SSH tunnel to the production database
Summary
This PR creates a command to generate JSON seeder files from the production database so maintainers and contributors can seed their local database with up-to-date content.
Usage
The command to generate/update the JSON seeder files is as follows:
The
--all
option can be used to sync all content tables from production and automatically override the contents of any existing seeder files during the update. When this option is omitted, users can choose which data they'd like to sync:The
--override
option can be used to automatically override the contents of any existing seeder files when updating a single table. Otherwise, the user will need to confirm this action during the update:With the seeder files in place, users should run the following command to update their local development data:
Implementation
For now, maintainers should periodically run the command to update the seeder files and commit those changes to the repo. This can especially be done when new resources etc are added to the production site via Nova.
Maintainer Note: Be sure to set the following env variables to connect to the Forge server where Onramp is hosted
Future Improvements
To eliminate the need for manually updating these files, we should implement running a scheduled command that regenerates the seeder files for us and commits those changes from the server (h/t @darkboywonder). When this happens we should:
stechstudio/laravel-ssh-tunnel
package used to create an SSH tunnel to the production database