feat: fix seeder
This commit is contained in:
parent
83f92dd7a1
commit
d47058054d
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue