Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
8 changes: 1 addition & 7 deletions app/Models/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
13 changes: 1 addition & 12 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
}

}
}
61 changes: 61 additions & 0 deletions database/migrations/2026_04_16_081129_initial_program_seed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

use App\Enum\BeepLeadIn;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
DB::table('settings')->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
{
//
}
};
43 changes: 0 additions & 43 deletions database/seeders/DatabaseSeeder.php

This file was deleted.

Loading