Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117879744
2022_07_07_100000_ip_nets_optimization.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
2022_07_07_100000_ip_nets_optimization.php
View Options
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Schema
;
return
new
class
extends
Migration
{
/**
* Run the migrations.
*/
public
function
up
():
void
{
Schema
::
dropIfExists
(
'ip4nets'
);
Schema
::
dropIfExists
(
'ip6nets'
);
Schema
::
create
(
'ip4nets'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'rir_name'
,
8
);
$table
->
bigInteger
(
'net_number'
);
$table
->
bigInteger
(
'net_broadcast'
);
$table
->
tinyInteger
(
'net_mask'
)->
unsigned
();
$table
->
string
(
'country'
,
2
)->
nullable
();
$table
->
bigInteger
(
'serial'
)->
unsigned
();
$table
->
timestamps
();
$table
->
index
([
'net_number'
,
'net_broadcast'
,
'net_mask'
]);
}
);
Schema
::
create
(
'ip6nets'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'rir_name'
,
8
);
$table
->
bigInteger
(
'net_number'
);
$table
->
bigInteger
(
'net_broadcast'
);
$table
->
tinyInteger
(
'net_mask'
)->
unsigned
();
$table
->
string
(
'country'
,
2
)->
nullable
();
$table
->
bigInteger
(
'serial'
)->
unsigned
();
$table
->
timestamps
();
$table
->
index
([
'net_number'
,
'net_broadcast'
,
'net_mask'
]);
}
);
// VARBINARY is MySQL specific and Laravel does not support it natively
DB
::
statement
(
"alter table ip4nets change net_number net_number varbinary(4) not null"
);
DB
::
statement
(
"alter table ip4nets change net_broadcast net_broadcast varbinary(4) not null"
);
DB
::
statement
(
"alter table ip6nets change net_number net_number varbinary(16) not null"
);
DB
::
statement
(
"alter table ip6nets change net_broadcast net_broadcast varbinary(16) not null"
);
}
/**
* Reverse the migrations.
*/
public
function
down
():
void
{
Schema
::
dropIfExists
(
'ip4nets'
);
Schema
::
dropIfExists
(
'ip6nets'
);
Schema
::
create
(
'ip4nets'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'rir_name'
,
8
);
$table
->
string
(
'net_number'
,
15
)->
index
();
$table
->
tinyInteger
(
'net_mask'
)->
unsigned
();
$table
->
string
(
'net_broadcast'
,
15
)->
index
();
$table
->
string
(
'country'
,
2
)->
nullable
();
$table
->
bigInteger
(
'serial'
)->
unsigned
();
$table
->
timestamps
();
$table
->
index
([
'net_number'
,
'net_mask'
,
'net_broadcast'
]);
}
);
Schema
::
create
(
'ip6nets'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'rir_name'
,
8
);
$table
->
string
(
'net_number'
,
39
)->
index
();
$table
->
tinyInteger
(
'net_mask'
)->
unsigned
();
$table
->
string
(
'net_broadcast'
,
39
)->
index
();
$table
->
string
(
'country'
,
2
)->
nullable
();
$table
->
bigInteger
(
'serial'
)->
unsigned
();
$table
->
timestamps
();
$table
->
index
([
'net_number'
,
'net_mask'
,
'net_broadcast'
]);
}
);
}
};
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Apr 5, 11:07 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18794676
Default Alt Text
2022_07_07_100000_ip_nets_optimization.php (3 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline