#!/usr/bin/env bash # Seed a dev admin user (sUserName=admin, password=666666). # Run once after first `mvn spring-boot:run` so Flyway has applied V1. # Idempotent: uses INSERT IGNORE on the unique key. set -euo pipefail DB_HOST="${DB_HOST:-127.0.0.1}" DB_PORT="${DB_PORT:-3306}" DB_SCHEMA="${DB_SCHEMA:-xly_erp}" DB_USER="${DB_USER:-root}" # BCrypt(666666) cost 10. Spring's BCryptPasswordEncoder accepts both $2a$ and $2b$ prefixes. HASH='$2b$10$ZzbGP0yWo3QJkaiZqEgtAOQVrzrti911VqbY7FoethhGQFPV0/Oj6' mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" ${DB_PASSWORD:+-p"$DB_PASSWORD"} "$DB_SCHEMA" <