| Total Complexity | 2 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | class CreateMasterStatesTable extends Migration |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Run the migrations. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | Schema::create('tm_states', function (Blueprint $table) { |
||
| 17 | $table->bigIncrements('id'); |
||
| 18 | $table->unsignedBigInteger('country_id'); |
||
| 19 | $table->string('name', 255); |
||
| 20 | $table->string('region', 255)->nullable(); |
||
| 21 | $table->string('iso_3166_2', 2)->nullable(); |
||
| 22 | $table->string('region_code', 10)->nullable(); |
||
| 23 | $table->string('calling_code', 5)->nullable(); |
||
| 24 | $table->string('latitude')->nullable(); |
||
| 25 | $table->string('longitude')->nullable(); |
||
| 26 | $table->boolean('active')->default(1); |
||
| 27 | $table->timestamps(); |
||
| 28 | }); |
||
| 29 | |||
| 30 | Schema::table('tm_states', function (Blueprint $table) { |
||
| 31 | $table->foreign('country_id') |
||
| 32 | ->references('id')->on('tm_countries') |
||
| 33 | ->onDelete('cascade'); |
||
| 34 | }); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Reverse the migrations. |
||
| 39 | * |
||
| 40 | * @return void |
||
| 41 | */ |
||
| 42 | public function down() |
||
| 43 | { |
||
| 44 | Schema::dropIfExists('tm_states'); |
||
| 45 | } |
||
| 47 |