2025_09_05_103000_create_resources_table.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. use App\Database\Migrations\TenantMigration;
  6. return new class extends TenantMigration
  7. {
  8. /**
  9. * Run the migrations.
  10. */
  11. public function up(): void
  12. {
  13. Schema::create('resources', function (Blueprint $table) {
  14. $table->id();
  15. $table->unsignedBigInteger('user_id')->nullable();
  16. //$table->foreign('birth_place_id')->nullable()->references('id')->on('cities')->onUpdate('cascade')->onDelete('cascade');
  17. $table->string('first_name')->nullable();
  18. $table->string('last_name')->nullable();
  19. $table->date('birth_day')->nullable();
  20. $table->unsignedBigInteger('birth_place_id')->nullable();
  21. $table->foreign('birth_place_id')->nullable()->references('id')->on('cities')->onUpdate('cascade')->onDelete('cascade');
  22. $table->string('fiscal_code')->nullable();
  23. $table->string('phone')->nullable();
  24. $table->string('email')->nullable();
  25. $table->string('address')->nullable();
  26. $table->string('zip')->nullable();
  27. $table->unsignedBigInteger('city_id')->nullable();
  28. $table->foreign('city_id')->nullable()->references('id')->on('cities')->onUpdate('cascade')->onDelete('cascade');
  29. $table->unsignedBigInteger('country_id')->nullable();
  30. $table->foreign('country_id')->nullable()->references('id')->on('countries')->onUpdate('cascade')->onDelete('cascade');
  31. $table->boolean('domicile')->default(1);
  32. $table->boolean('enabled')->default(1);
  33. $table->softDeletes();
  34. $table->timestamps();
  35. });
  36. }
  37. /**
  38. * Reverse the migrations.
  39. */
  40. public function down(): void
  41. {
  42. Schema::dropIfExists('resources');
  43. }
  44. };