feat: workout sesssions
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('workout_sessions', function (Blueprint $table) {
|
||||
$table->ulid('id')->primary();
|
||||
$table->foreignUlid('user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->string('external_id')->nullable();
|
||||
$table->string('source')->default('manual');
|
||||
$table->string('type');
|
||||
$table->string('title');
|
||||
$table->integer('duration_seconds');
|
||||
$table->integer('calories_burned');
|
||||
$table->bigInteger('distance_meters');
|
||||
$table->timestampTz('started_at')->nullable();
|
||||
|
||||
$table->unique(['source', 'external_id']);
|
||||
|
||||
$table->timestampsTz();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('workout_sessions');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user