Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Functional\Tracking\Enums\WorkoutSessionStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('workout_sessions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained();
|
||||
$table->foreignId('routine_id')->nullable()->constrained(); // séance issue d'une routine (optionnel)
|
||||
$table->foreignId('program_id')->nullable()->constrained(); // séance issue d'un programme (optionnel)
|
||||
$table->string('title')->nullable();
|
||||
$table->dateTime('started_at');
|
||||
$table->dateTime('ended_at')->nullable();
|
||||
$table->string('status')->default(WorkoutSessionStatus::Active->value)->index();
|
||||
$table->text('notes')->nullable();
|
||||
$table->decimal('total_volume', 10, 2)->nullable(); // somme reps*poids calculée à la complétion
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('workout_sessions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('set_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('workout_session_id')->constrained();
|
||||
$table->foreignId('exercise_id')->constrained();
|
||||
$table->unsignedInteger('set_number');
|
||||
$table->unsignedInteger('reps')->nullable();
|
||||
$table->decimal('weight', 8, 2)->nullable();
|
||||
$table->decimal('rpe', 3, 1)->nullable(); // Rate of Perceived Exertion (0-10)
|
||||
$table->unsignedInteger('duration_seconds')->nullable(); // séries cardio/isométriques
|
||||
$table->decimal('distance_meters', 8, 2)->nullable(); // séries cardio (course, rameur...)
|
||||
$table->boolean('is_warmup')->default(false);
|
||||
$table->boolean('is_completed')->default(true);
|
||||
$table->dateTime('logged_at');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('set_logs');
|
||||
}
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_records', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained();
|
||||
$table->foreignId('exercise_id')->constrained();
|
||||
$table->string('type')->index();
|
||||
$table->decimal('value', 10, 2);
|
||||
$table->string('unit'); // "kg", "lb", "sec"...
|
||||
$table->dateTime('achieved_at');
|
||||
$table->foreignId('workout_session_id')->nullable()->constrained(); // séance à l'origine du record (si connue)
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'exercise_id', 'type']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_records');
|
||||
}
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('body_metrics', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained();
|
||||
$table->date('measured_on');
|
||||
$table->decimal('weight', 6, 2)->nullable();
|
||||
$table->decimal('body_fat', 5, 2)->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'measured_on']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('body_metrics');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user