forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2016_08_30_212718_add_ip_alias.php
More file actions
39 lines (35 loc) · 983 Bytes
/
2016_08_30_212718_add_ip_alias.php
File metadata and controls
39 lines (35 loc) · 983 Bytes
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
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIpAlias extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->text('ip_alias')->nullable()->after('ip');
});
$allocations = DB::select('SELECT id, ip FROM allocations');
foreach ($allocations as $allocation) {
DB::update(
'UPDATE allocations SET ip_alias = :ip WHERE id = :id',
[
'ip' => $allocation->ip,
'id' => $allocation->id,
]
);
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropColumn('ip_alias');
});
}
}