Files
lotteryLaravel/database/migrations/2026_05_08_100007_create_draws_table.php

36 lines
1.2 KiB
PHP

<?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('draws', function (Blueprint $table) {
$table->id();
$table->string('draw_no', 32)->unique();
$table->date('business_date');
$table->unsignedInteger('sequence_no');
$table->string('status', 32);
$table->timestamp('start_time')->nullable();
$table->timestamp('close_time')->nullable();
$table->timestamp('draw_time')->nullable();
$table->timestamp('cooling_end_time')->nullable();
$table->string('result_source', 16)->nullable()->comment('rng|manual');
$table->unsignedInteger('current_result_version')->default(0);
$table->unsignedInteger('settle_version')->default(0);
$table->boolean('is_reopened')->default(false);
$table->timestamps();
$table->index(['status', 'draw_time'], 'idx_draws_status_draw_time');
});
}
public function down(): void
{
Schema::dropIfExists('draws');
}
};