52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class UpdateZones extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
DB::statement('ALTER TABLE zones ALTER COLUMN domain_id SET NOT NULL');
|
|
|
|
Schema::table('zones', function (Blueprint $table) {
|
|
$table->dropColumn(['name','description','ipv4','ipv4_mask','ipv6','ipv6_mask','zt_id']);
|
|
$table->string('ztid')->nullable();
|
|
$table->dropUnique(['domain_id']);
|
|
|
|
$table->integer('system_id');
|
|
$table->foreign('system_id')->references('id')->on('systems');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
DB::statement('ALTER TABLE zones ALTER COLUMN domain_id DROP NOT NULL');
|
|
|
|
Schema::table('zones', function (Blueprint $table) {
|
|
$table->dropForeign(['system_id']);
|
|
$table->dropColumn(['system_id','ztid']);
|
|
$table->unique('domain_id');
|
|
|
|
$table->string('name');
|
|
$table->string('description');
|
|
$table->ipAddress('ipv4')->nullable();
|
|
$table->integer('ipv4_mask')->nullable();
|
|
$table->ipAddress('ipv6')->nullable();
|
|
$table->integer('ipv6_mask')->nullable();
|
|
$table->binary('zt_id')->nullable()->unique();
|
|
});
|
|
}
|
|
}
|