-
Notifications
You must be signed in to change notification settings - Fork 46
/
2022_08_11_165441_add_vpn_fields.php
65 lines (56 loc) · 2.46 KB
/
2022_08_11_165441_add_vpn_fields.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddVpnFields extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('external_connected_entities', function (Blueprint $table) {
$table->dropColumn("responsible_sec");
});
Schema::table('external_connected_entities', function (Blueprint $table) {
$table->longText('description')->nullable()->after("name");
$table->string("type")->nullable()->after("description");
$table->unsignedInteger('entity_id')->after('type')->nullable()->index('entity_id_fk_1295034');
$table->unsignedInteger('network_id')->after('entity_id')->nullable()->index('network_id_fk_8596554');
$table->string("src")->nullable()->after("network_id");
$table->string("dest")->nullable()->after("src");
});
Schema::table('external_connected_entities', function (Blueprint $table) {
$table->foreign('entity_id', 'entity_id_fk_1295034')->references('id')->on('entities')->onUpdate('NO ACTION')->onDelete('CASCADE');
$table->foreign('network_id', 'network_id_fk_8596554')->references('id')->on('networks')->onUpdate('NO ACTION')->onDelete('CASCADE');
});
Schema::dropIfExists('external_connected_entity_network');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('external_connected_entities', function (Blueprint $table) {
$table->dropColumn(['description', 'type']);
$table->string("responsible_sec")->nullable()->after("name");
if (DB::getDriverName() !== 'sqlite') {
$table->dropForeign('network_id_fk_8596554');
}
$table->dropColumn(['network_id']);
if (DB::getDriverName() !== 'sqlite') {
$table->dropForeign('entity_id_fk_1295034');
}
$table->dropColumn(['entity_id']);
$table->dropColumn(['src', 'dest']);
});
Schema::create('external_connected_entity_network', function (Blueprint $table) {
$table->unsignedInteger('external_connected_entity_id')->index('external_connected_entity_id_fk_1483344');
$table->unsignedInteger('network_id')->index('network_id_fk_1483344');
});
}
}