feature test su institution
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user