From 9259fd7a1eb537cebe399344df428b0fa62cf41b Mon Sep 17 00:00:00 2001
From: Fabrice Gangler <fabrice.gangler@adullact.org>
Date: Sun, 23 Mar 2025 21:20:16 +0100
Subject: [PATCH] feat(dev): allow clean up database and load fixture (DEV
 environment)

---
 Makefile | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 04517a6..cae3e2e 100644
--- a/Makefile
+++ b/Makefile
@@ -68,15 +68,6 @@ gitlab_api_logout: ## Logout to Gitlab API
 	cd .gitlab/ci/Dockerfiles && ./90_gitlab-logout.sh
 .PHONY: gitlab_api_logout
 
-##
-##--- SYMFONY database --------------------------------------------------------
-
-migration_database: ## Apply Doctrine migrations
-	cd "${WEBAPP_DIR}"        && bin/console doctrine:migrations:list       --env=dev
-	cd "${WEBAPP_DIR}"        && bin/console doctrine:migrations:migrate -n --env=dev
-	cd "${WEBAPP_DIR}"        && bin/console doctrine:migrations:list       --env=dev
-.PHONY: migration_database
-
 ##
 ##--- DOCKER ------------------------------------------------------------------
 
@@ -95,6 +86,22 @@ docker_with_empty-database: ## Run Docker containers (database, mailcatcher)  wi
 	cd "${WEBAPP_DIR}/docker" && docker-compose up
 .PHONY: docker_with_empty-database
 
+##
+##--- DEV environment --------------------------------------------------------
+
+migration_database_env_dev: ## Apply Doctrine migrations (DEV environment)
+	cd "${WEBAPP_DIR}"        && bin/console doctrine:migrations:list       --env=dev
+	cd "${WEBAPP_DIR}"        && bin/console doctrine:migrations:migrate -n --env=dev
+	cd "${WEBAPP_DIR}"        && bin/console doctrine:migrations:list       --env=dev
+.PHONY: migration_database_env_dev
+
+load_fixture_env_dev: ## Clean up database and load fixture (DEV environment)
+	cd "${WEBAPP_DIR}" && bin/console doctrine:database:drop --force --env=dev || true
+	cd "${WEBAPP_DIR}" && bin/console doctrine:database:create       --env=dev
+	cd "${WEBAPP_DIR}" && bin/console doctrine:migrations:migrate -n --env=dev
+	cd "${WEBAPP_DIR}" && bin/console doctrine:fixtures:load      -n --env=dev
+.PHONY: load_fixture_env_dev
+
 
 ##
 ##--- TESTS -------------------------------------------------------------------
-- 
GitLab