2024_04_09_112300_create_sponsors_table.php 1.7 KB

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