string('mailer_address')->nullable(); $table->integer('mailer_port')->nullable(); $table->integer('mailer_type')->nullable(); $table->string('zt_id',10)->nullable()->unique(); $table->unique(['mailer_type','mailer_address','mailer_port']); }); Schema::table('zones', function (Blueprint $table) { $table->dropColumn(['ztid']); }); Schema::table('zones', function (Blueprint $table) { $table->string('zt_id',16)->unique()->nullable(); $table->ipAddress('zt_ipv4')->nullable(); $table->integer('zt_ipv4_mask')->nullable(); $table->unique(['zt_ipv4','zt_ipv4_mask']); $table->ipAddress('zt_ipv6')->nullable(); $table->integer('zt_ipv6_mask')->nullable(); $table->unique(['zt_ipv6','zt_ipv6_mask']); }); Schema::create('address_zone', function (Blueprint $table) { $table->string('sespass')->nullable(); $table->string('pktpass',8)->nullable(); $table->string('ticpass')->nullable(); $table->string('fixpass')->nullable(); $table->ipAddress('zt_ipv4')->nullable(); $table->ipAddress('zt_ipv6')->nullable(); $table->integer('system_id'); $table->foreign('system_id')->references('id')->on('systems'); $table->integer('zone_id'); $table->foreign('zone_id')->references('id')->on('zones'); $table->unique(['system_id','zone_id']); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('address_zone'); Schema::table('zones', function (Blueprint $table) { $table->dropUnique(['zt_id']); $table->dropColumn(['zt_id']); $table->dropUnique(['zt_ipv4','zt_ipv4_mask']); $table->dropUnique(['zt_ipv6','zt_ipv6_mask']); $table->dropColumn(['zt_ipv4','zt_ipv4_mask']); $table->dropColumn(['zt_ipv6','zt_ipv6_mask']); }); Schema::table('zones', function (Blueprint $table) { $table->string('ztid')->nullable(); }); Schema::table('systems', function (Blueprint $table) { $table->dropUnique(['zt_id']); $table->dropUnique(['mailer_type','mailer_address','mailer_port']); $table->dropColumn(['mailer_address','mailer_port','mailer_type','zt_id']); }); } }