feature test su institution

This commit is contained in:
Giuseppe Naponiello
2026-06-22 22:14:15 +02:00
parent cc4e174880
commit fe73662903
39 changed files with 2432 additions and 1 deletions

View File

@@ -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::create('institution_categories', function (Blueprint $table) {
$table->id();
$table->string('value', 25)->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('institution_categories');
}
};

View File

@@ -0,0 +1,45 @@
<?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('institutions', function (Blueprint $table) {
$table->id();
$table->foreignId('category_id')
->constrained('institution_categories')
->cascadeOnUpdate()
->restrictOnDelete();
$table->string('name')->unique();
$table->string('abbreviation', 5)->unique();
$table->string('address');
$table->string('city', 100)->index();
$table->decimal('lat', 10, 6);
$table->decimal('lon', 10, 6);
$table->string('logo');
$table->string('color', 50)->default('#c5cae9');
$table->uuid('uuid')->unique();
$table->boolean('is_storage_place')->default(true);
// Id del record nel DB legacy (v1): chiave di upsert per l'ETL e per
// risolvere le FK delle tabelle dipendenti (es. artifact.owner).
$table->unsignedBigInteger('legacy_id')->nullable()->unique();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('institutions');
}
};

View File

@@ -0,0 +1,37 @@
<?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('institution_links', function (Blueprint $table) {
$table->id();
$table->foreignId('institution_id')
->constrained()
->cascadeOnDelete();
$table->string('url', 2000);
// Vincolato a App\Enums\InstitutionLinkType (cast + validazione lato app).
$table->string('type', 30);
$table->string('label', 100)->nullable();
$table->unsignedSmallInteger('sort_order')->default(0);
$table->timestamps();
$table->index(['institution_id', 'sort_order']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('institution_links');
}
};