Seed Data Generation
This guide can be used to create databases with seed data. Note that seed data generation should ONLY be used on development or test environments as, without modifications to the scripts below, the databases are dropped and recreated.
Getting Started
Step 1: Docker Seeding Script
#!/bin/bash
set -e
echo "Dropping databases."
mysql -hmariadb -uroot -ppassword -e 'DROP DATABASE IF EXISTS <ELENTRA_ME>;'
mysql -hmariadb -uroot -ppassword -e 'DROP DATABASE IF EXISTS <ELENTRA_ME_CLERKSHIP>;'
mysql -hmariadb -uroot -ppassword -e 'DROP DATABASE IF EXISTS <ELENTRA_AUTH>;'
echo "Creating databases."
mysql -hmariadb -uroot -ppassword -e 'CREATE DATABASE <ELENTRA_ME>;'
mysql -hmariadb -uroot -ppassword -e 'CREATE DATABASE <ELENTRA_ME_CLERKSHIP>;'
mysql -hmariadb -uroot -ppassword -e 'CREATE DATABASE <ELENTRA_AUTH>;'
cd /var/www/vhosts/elentra-1x-me
rm www-root/core/config/config.inc.php
echo "Installing Elentra config script."
php www-root/setup/install.php \
--entrada-url=http://elentra-1x-me.localhost \
--entrada-absolute=$(pwd)/www-root \
--entrada-storage=$(pwd)/www-root/core/storage \
--database-adapter=mysqli \
--database-host=mariadb \
--database-username=root \
--database-password=password \
--entrada-database=<ELENTRA_ME> \
--auth-database=<ELENTRA_AUTH> \
--clerkship-database=<ELENTRA_ME_CLERKSHIP> \
--admin-username=user1 \
--admin-password=apple123 \
--admin-firstname=System \
--admin-lastname=Adminstrator \
[email protected]
echo "Running Migrations."
php elentra migrate --up --quiet
cd /var/www/vhosts/elentra-1x-me/www-root/core/library/vendor/elentrapackages/elentra-1x-api
#This could be used to test the seeding of a specific module
#php artisan db:seed --class=LotteriesSeeder
#This will seed all registered seed modules
php artisan db:seed --quietStep 2: Creating a JSON Seed File
Creating a Seed Data File With No Model Class
Step 3: Registering the Seed File
4: Adding the Seed Data Registry to Laravel
Step 4: Running the Seed Scripts
Troubleshooting:
TLDR;
Last updated