2023_03_20_212903_create_members_table.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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('members', function (Blueprint $table) {
  15. $table->id();
  16. $table->string('first_name');
  17. $table->string('last_name');
  18. $table->string('status');
  19. $table->unsignedBigInteger('birth_city_id')->nullable();
  20. $table->foreign('birth_city_id')->nullable()->references('id')->on('cities')->onUpdate('cascade')->onDelete('cascade');
  21. $table->unsignedBigInteger('birth_province_id')->nullable();
  22. $table->foreign('birth_province_id')->nullable()->references('id')->on('provinces')->onUpdate('cascade')->onDelete('cascade');
  23. $table->unsignedBigInteger('birth_nation_id')->nullable();
  24. $table->foreign('birth_nation_id')->nullable()->references('id')->on('nations')->onUpdate('cascade')->onDelete('cascade');
  25. $table->date('birth_date')->nullable();
  26. $table->string('gender', 1)->nullable();
  27. $table->string('fiscal_code', 16)->nullable();
  28. $table->string('address')->nullable();
  29. $table->string('zip_code', 5)->nullable();
  30. $table->unsignedBigInteger('nation_id')->nullable();
  31. $table->foreign('nation_id')->nullable()->references('id')->on('nations')->onUpdate('cascade')->onDelete('cascade');
  32. $table->unsignedBigInteger('province_id')->nullable();
  33. $table->foreign('province_id')->nullable()->references('id')->on('provinces')->onUpdate('cascade')->onDelete('cascade');
  34. $table->unsignedBigInteger('city_id')->nullable();
  35. $table->foreign('city_id')->nullable()->references('id')->on('cities')->onUpdate('cascade')->onDelete('cascade');
  36. $table->string('phone')->nullable();
  37. $table->string('email')->nullable();
  38. $table->string('image')->nullable();
  39. $table->string('father_name')->nullable();
  40. $table->string('father_mail')->nullable();
  41. $table->string('father_phone')->nullable();
  42. $table->string('father_fiscal_code')->nullable();
  43. $table->string('mother_name')->nullable();
  44. $table->string('mother_mail')->nullable();
  45. $table->string('mother_phone')->nullable();
  46. $table->string('mother_fiscal_code')->nullable();
  47. $table->string('birth_place')->nullable();
  48. $table->integer('enabled')->default(1);
  49. $table->softDeletes();
  50. $table->timestamps();
  51. });
  52. }
  53. /**
  54. * Reverse the migrations.
  55. *
  56. * @return void
  57. */
  58. public function down()
  59. {
  60. Schema::dropIfExists('members');
  61. }
  62. };