Added Zones, authorisation on edits, validation enhancements
This commit is contained in:
51
database/migrations/2021_06_18_112022_update_zones.php
Normal file
51
database/migrations/2021_06_18_112022_update_zones.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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();
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user