File: /var/www/admin.javaapp.co.uk/database/migrations/2023_01_19_135157_create_cafe_timings_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cafe_timings', function (Blueprint $table) {
$table->id();
$table->tinyInteger('day')->comment('start from sunday = 0 to saturday = 6');
$table->string('open_time')->default('');
$table->string('close_time')->default('');
$table->foreignId('cafe_id')->nullable()->constrained('cafes')->onDelete('cascade');
$table->tinyInteger('is_active')->default(0)->comment('1 = active, 0 = inactive');
$table->unsignedInteger('created_at')->default(0);
$table->unsignedInteger('updated_at')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('cafe_timings', function (Blueprint $table) {
$table->dropConstrainedForeignId('cafe_id');
});
Schema::dropIfExists('cafe_timings');
}
};