Skip to content

Commit

Permalink
Merge pull request #1918 from tomudding/chore/initial-data-fixtures-f…
Browse files Browse the repository at this point in the history
…or-seeding-the-database

chore: add initial data seeders
  • Loading branch information
tomudding authored Nov 13, 2024
2 parents 22ec33b + 5eb9f74 commit 8a134af
Show file tree
Hide file tree
Showing 17 changed files with 693 additions and 192 deletions.
2 changes: 2 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ rundev: builddev
@make replenish
@docker compose exec web rm -rf data/cache/module-config-cache.application.config.cache.php

migrate: replenish
@docker compose exec -it web ./orm migrations:migrate

migration-list: replenish
@docker compose exec -T web ./orm migrations:list

migration-diff: replenish
@docker compose exec -T web ./orm migrations:diff
@docker cp "$(shell docker compose ps -q web)":/code/module/Application/migrations ./module/Application/migrations

migration-migrate: replenish
@docker compose exec -it web ./orm migrations:migrate

migration-up: replenish migration-list
@read -p "Enter the migration version to execute (e.g., Application\\Migrations\\Version20241020212355 -- note escaping the backslashes is required): " version; \
docker compose exec -it web ./orm migrations:execute --up $$version
Expand All @@ -60,6 +60,9 @@ migration-down: replenish migration-list
@read -p "Enter the migration version to down (e.g., Application\\Migrations\\Version20241020212355 -- note escaping the backslashes is required): " version; \
docker compose exec -it web ./orm migrations:execute --down $$version

seed: replenish
@docker compose exec -T web ./web application:fixtures:load

exec:
docker compose exec -it web $(cmd)

Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
"psalm/plugin-phpunit": "^0.18.4",
"maglnet/composer-require-checker": "^4.10.0",
"icanhazstring/composer-unused": "^0.8.11",
"gewis/gewisphp-coding-standards": "^1.1.0"
"gewis/gewisphp-coding-standards": "^1.1.0",
"doctrine/data-fixtures": "^2.0",
"fakerphp/faker": "^1.23"
},
"replace": {
"laminas/laminas-cache-storage-adapter-apc": "*",
Expand Down
148 changes: 147 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions module/Application/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Application;

use Application\Command\LoadFixtures;
use Application\Controller\Factory\IndexControllerFactory;
use Application\Controller\IndexController;
use Application\View\Helper\BootstrapElementError;
Expand Down Expand Up @@ -148,6 +149,11 @@
'message_separator_string' => '</li><li>',
],
],
'laminas-cli' => [
'commands' => [
'application:fixtures:load' => LoadFixtures::class,
],
],
'doctrine' => [
'driver' => [
__NAMESPACE__ . '_driver' => [
Expand Down
Loading

0 comments on commit 8a134af

Please sign in to comment.