feat: add breath_hold & duration

This commit is contained in:
2025-09-13 16:54:17 +03:30
parent 0b73e9d095
commit c8bf4011e2
4 changed files with 164 additions and 38 deletions
@@ -0,0 +1,31 @@
<?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()
{
Schema::table('breathing_templates', function (Blueprint $table) {
$table->integer('breath_hold')->default(0)->after('exhale');
$table->integer('duration')->default(60)->after('breath_hold');
$table->dropColumn('repeat'); // only if you are sure you no longer need it
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::table('breathing_templates', function (Blueprint $table) {
$table->dropColumn(['breath_hold', 'duration']);
$table->integer('repeat')->default(1); // rollback safety
});
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('user_breathing_sessions', function (Blueprint $table) {
$table ->integer('duration')->default(60)->after('template_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('user_breathing_sessions', function (Blueprint $table) {
$table->dropColumn('duration');
});
}
};