diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index f20fc4a..10db264 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -15,7 +15,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Bump patch version and version_code run: | diff --git a/app/Models/Setting.php b/app/Models/Setting.php index f62fee6..b657969 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -30,12 +30,6 @@ class Setting extends Model /** Returns the single settings row, creating it with defaults on first run. */ public static function current(): self { - return self::first() ?? self::create([ - 'default_beep_lead_in' => BeepLeadIn::Three->value, - 'default_end_sound' => 'triple', - 'sound_mode' => 'beep', - 'volume' => 0.8, - 'keep_screen_on' => true, - ]); + return self::first(); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index bf60378..0d97006 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,9 +3,7 @@ namespace App\Providers; use App\Timer\TimerRunner; -use Database\Seeders\DatabaseSeeder; use Illuminate\Support\ServiceProvider; -use Throwable; class AppServiceProvider extends ServiceProvider { @@ -22,15 +20,6 @@ public function register(): void */ public function boot(): void { - // On the first installation (empty programs table) seed the demo HIIT program. - // The guard inside DatabaseSeeder::run() makes this idempotent. - // Wrapped in try/catch: during `artisan migrate` the program table - // does not yet exist when the service provider boots — swallow that - // gracefully and let the seeder succeed on the next boot. - try { - (new DatabaseSeeder)->run(); - } catch (Throwable $e) { - report($e); - } + } } diff --git a/database/migrations/2026_04_16_081129_initial_program_seed.php b/database/migrations/2026_04_16_081129_initial_program_seed.php new file mode 100644 index 0000000..0b6fed0 --- /dev/null +++ b/database/migrations/2026_04_16_081129_initial_program_seed.php @@ -0,0 +1,61 @@ +truncate(); + + DB::table('settings')->insert([ + 'default_beep_lead_in' => BeepLeadIn::Three->value, + 'default_end_sound' => 'triple', + 'sound_mode' => 'beep', + 'volume' => 0.8, + 'keep_screen_on' => true, + ]); + + $programId = Str::uuid7()->toString(); + Log::info(sprintf('Program ID: %s', $programId)); + + DB::table('programs')->insert([ + 'id' => $programId, + 'name' => 'HIIT', + 'beep_lead_in' => BeepLeadIn::Three->value, + 'end_sound' => 'chime', + ]); + + foreach ([ + ['label' => 'Warmup', 'duration' => 10, 'repetitions' => 1, 'pause' => 0, 'cooldown' => 5, 'color' => '#3b82f6'], + ['label' => 'Sprint', 'duration' => 8, 'repetitions' => 3, 'pause' => 4, 'cooldown' => 10, 'color' => '#ef4444'], + ['label' => 'Stretch', 'duration' => 8, 'repetitions' => 1, 'pause' => 0, 'cooldown' => 0, 'color' => '#22c55e'], + ] as $index => $phase) { + DB::table('phases')->insert( + array_merge( + $phase, + [ + 'program_id' => $programId, + 'sort_order' => $index, + ], + ), + ); + } + } + + + /** + * Reverse the migrations. + */ + public + function down(): void + { + // + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php deleted file mode 100644 index 9ea6644..0000000 --- a/database/seeders/DatabaseSeeder.php +++ /dev/null @@ -1,43 +0,0 @@ - 'HIIT', - 'beep_lead_in' => BeepLeadIn::Three->value, - 'end_sound' => 'chime', - ]); - - foreach ([ - ['label' => 'Warmup', 'duration' => 10, 'repetitions' => 1, 'pause' => 0, 'cooldown' => 5, 'color' => '#3b82f6'], - ['label' => 'Sprint', 'duration' => 8, 'repetitions' => 3, 'pause' => 4, 'cooldown' => 10, 'color' => '#ef4444'], - ['label' => 'Stretch','duration' => 8, 'repetitions' => 1, 'pause' => 0, 'cooldown' => 0, 'color' => '#22c55e'], - ] as $phase) { - $program->addPhase($phase); - } - } -}