2025_08_08_102010_create_companies_table.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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('companies', function (Blueprint $table) {
  14. $table->id();
  15. $table->string('name');
  16. $table->string('business_name')->nullable();
  17. $table->string('logo')->nullable();
  18. $table->string('phone')->nullable();
  19. $table->string('email')->nullable();
  20. $table->string('pec')->nullable();
  21. $table->date('costitution_date')->nullable();
  22. $table->string('address')->nullable();
  23. $table->string('zip')->nullable();
  24. $table->unsignedBigInteger('city_id')->nullable();
  25. $table->foreign('city_id')->nullable()->references('id')->on('cities')->onUpdate('cascade')->onDelete('cascade');
  26. $table->unsignedBigInteger('country_id')->nullable();
  27. $table->foreign('country_id')->nullable()->references('id')->on('countries')->onUpdate('cascade')->onDelete('cascade');
  28. $table->string('operational_headquarters')->nullable();
  29. $table->string('fiscal_code')->nullable();
  30. $table->string('vat')->nullable();
  31. $table->string('sdi_code')->nullable();
  32. $table->string('ateco_code')->nullable();
  33. $table->boolean('enabled')->default(1);
  34. $table->softDeletes();
  35. $table->timestamps();
  36. });
  37. }
  38. /**
  39. * Reverse the migrations.
  40. */
  41. public function down(): void
  42. {
  43. Schema::dropIfExists('companies');
  44. }
  45. };