lernschiff/database/migrations/2026_05_22_005035_create_li...

38 lines
1.0 KiB
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.
*/
public function up(): void
{
Schema::create('licenses', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
$table->unsignedBigInteger('tenant_id');
$table->enum('type', ['per_student', 'school_flat'])->default('per_student');
$table->unsignedInteger('seats')->nullable();
$table->date('expires_at')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
$table->softDeletes();
$table->foreign('tenant_id')->references('id')->on('tenants');
$table->index('tenant_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('licenses');
}
};