From d47058054d29013ce5832ac37fdacec604b4bc68 Mon Sep 17 00:00:00 2001 From: Leon Date: Wed, 14 Jan 2026 16:22:23 +0100 Subject: [PATCH] feat: fix seeder --- database/seeders/LevelSeeder.php | 3 +- docker-compose.prod.yml | 96 ++++++++++++++++---------------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/database/seeders/LevelSeeder.php b/database/seeders/LevelSeeder.php index 28ca05d..af6312d 100644 --- a/database/seeders/LevelSeeder.php +++ b/database/seeders/LevelSeeder.php @@ -23,8 +23,9 @@ class LevelSeeder extends Seeder $levelsPerTier = 10; $baseXp = 50; $scalingFactor = 20; + $totalLevels = count($tiers) * $levelsPerTier; - for ($level = 1; $level <= 100; $level++) { + for ($level = 1; $level <= $totalLevels; $level++) { // Déterminer le tier $tierIndex = intdiv($level - 1, $levelsPerTier); diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index aa3a626..87db29e 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -23,56 +23,56 @@ services: DB_USERNAME: "${DB_USERNAME}" DB_PASSWORD: "${DB_PASSWORD}" - treasure-api-migrate: - image: registry.gitlab.com/treasure-hunt4/treasure-api:latest - restart: "no" - depends_on: - - mysql - environment: - APP_ENV: "production" - APP_KEY: "${APP_KEY}" - APP_URL: "${APP_URL}" - SCOUT_DRIVER: "${SCOUT_DRIVER}" - MEILISEARCH_HOST: "${MEILISEARCH_HOST}" - MEILISEARCH_KEY: "${MEILISEARCH_KEY}" + # treasure-api-migrate: + # image: registry.gitlab.com/treasure-hunt4/treasure-api:latest + # restart: "no" + # depends_on: + # - mysql + # environment: + # APP_ENV: "production" + # APP_KEY: "${APP_KEY}" + # APP_URL: "${APP_URL}" + # SCOUT_DRIVER: "${SCOUT_DRIVER}" + # MEILISEARCH_HOST: "${MEILISEARCH_HOST}" + # MEILISEARCH_KEY: "${MEILISEARCH_KEY}" - DB_CONNECTION: "mysql" - DB_HOST: "mysql" - DB_PORT: 3306 - DB_DATABASE: "${DB_DATABASE}" - DB_USERNAME: "${DB_USERNAME}" - DB_PASSWORD: "${DB_PASSWORD}" + # DB_CONNECTION: "mysql" + # DB_HOST: "mysql" + # DB_PORT: 3306 + # DB_DATABASE: "${DB_DATABASE}" + # DB_USERNAME: "${DB_USERNAME}" + # DB_PASSWORD: "${DB_PASSWORD}" - # On attend que MySQL soit prêt et on retente la migration jusqu'à succès - command: > - sh -c " - echo '⏳ Waiting for MySQL on mysql:3306...'; - php -r ' - $host = getenv(\"DB_HOST\") ?: \"mysql\"; - $port = getenv(\"DB_PORT\") ?: \"3306\"; - $db = getenv(\"DB_DATABASE\") ?: \"\"; - $user = getenv(\"DB_USERNAME\") ?: \"\"; - $pass = getenv(\"DB_PASSWORD\") ?: \"\"; - while (true) { - try { - new PDO(\"mysql:host={$host};port={$port};dbname={$db}\", $user, $pass); - break; - } catch (Throwable $e) { - echo \"MySQL not ready: {$e->getMessage()}\\n\"; - sleep(2); - } - } - '; - echo '✅ MySQL is up, running migrations...'; - until php artisan migrate --force --no-interaction; do - echo '❌ Migration failed, retrying in 5s...'; - sleep 5; - done; - echo '✅ Migrations applied.'; - echo '🔗 Creating storage symlink...'; - php artisan storage:link || true; - echo '✅ Storage link done.'; - " + # # On attend que MySQL soit prêt et on retente la migration jusqu'à succès + # command: > + # sh -c " + # echo '⏳ Waiting for MySQL on mysql:3306...'; + # php -r ' + # $host = getenv(\"DB_HOST\") ?: \"mysql\"; + # $port = getenv(\"DB_PORT\") ?: \"3306\"; + # $db = getenv(\"DB_DATABASE\") ?: \"\"; + # $user = getenv(\"DB_USERNAME\") ?: \"\"; + # $pass = getenv(\"DB_PASSWORD\") ?: \"\"; + # while (true) { + # try { + # new PDO(\"mysql:host={$host};port={$port};dbname={$db}\", $user, $pass); + # break; + # } catch (Throwable $e) { + # echo \"MySQL not ready: {$e->getMessage()}\\n\"; + # sleep(2); + # } + # } + # '; + # echo '✅ MySQL is up, running migrations...'; + # until php artisan migrate --force --no-interaction; do + # echo '❌ Migration failed, retrying in 5s...'; + # sleep 5; + # done; + # echo '✅ Migrations applied.'; + # echo '🔗 Creating storage symlink...'; + # php artisan storage:link || true; + # echo '✅ Storage link done.'; + # " phpmyadmin: image: phpmyadmin:latest