Teren-app/database/migrations/2024_10_19_090817_create_accounts_table.php
2025-11-06 21:54:07 +01:00

44 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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('account_types', function (Blueprint $table) {
$table->id();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('accounts', function (Blueprint $table) {
$table->id();
$table->string('reference', 125)->nullable();
$table->string('description', 255)->nullable();
$table->foreignIdFor(\App\Models\Contract::class);
$table->foreignId('type_id')->references('id')->on('account_types');
$table->unsignedTinyInteger('active')->default(1);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('account_type');
Schema::dropIfExists('accounts');
}
};