2025_09_15_155200_create_customers_table.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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('customers', function (Blueprint $table) {
  14. $table->id();
  15. $table->string('name')->nullable();
  16. $table->string('business_name')->nullable();
  17. $table->string('code')->nullable();
  18. $table->unsignedBigInteger('group_id')->nullable();
  19. $table->foreign('group_id')->nullable()->references('id')->on('company_groups')->onUpdate('cascade')->onDelete('cascade');
  20. /*$table->unsignedBigInteger('activity_id')->nullable();
  21. $table->foreign('activity_id')->nullable()->references('id')->on('company_activities')->onUpdate('cascade')->onDelete('cascade');
  22. $table->unsignedBigInteger('activity_id')->nullable();
  23. $table->foreign('activity_id')->nullable()->references('id')->on('company_activities')->onUpdate('cascade')->onDelete('cascade');*/
  24. $table->string('address')->nullable();
  25. $table->string('zip')->nullable();
  26. $table->unsignedBigInteger('city_id')->nullable();
  27. $table->foreign('city_id')->nullable()->references('id')->on('cities')->onUpdate('cascade')->onDelete('cascade');
  28. $table->unsignedBigInteger('country_id')->nullable();
  29. $table->foreign('country_id')->nullable()->references('id')->on('countries')->onUpdate('cascade')->onDelete('cascade');
  30. $table->string('fiscal_code')->nullable();
  31. $table->string('vat')->nullable();
  32. $table->string('sdi')->nullable();
  33. $table->string('ateco')->nullable();
  34. $table->string('channel')->nullable();
  35. $table->string('website')->nullable();
  36. $table->string('email')->nullable();
  37. $table->string('pec')->nullable();
  38. $table->string('phone')->nullable();
  39. $table->string('first_name')->nullable();
  40. $table->string('last_name')->nullable();
  41. $table->string('email')->nullable();
  42. $table->string('phone')->nullable();
  43. $table->boolean('enabled')->default(1);
  44. $table->softDeletes();
  45. $table->timestamps();
  46. });
  47. }
  48. /**
  49. * Reverse the migrations.
  50. */
  51. public function down(): void
  52. {
  53. Schema::dropIfExists('customers');
  54. }
  55. };