Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485181
2022_03_02_100000_create_filesystem_tables.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
2022_03_02_100000_create_filesystem_tables.php
View Options
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
return
new
class
extends
Migration
{
/**
* Run the migrations.
*/
public
function
up
():
void
{
Schema
::
create
(
'fs_items'
,
function
(
Blueprint
$table
)
{
$table
->
string
(
'id'
,
36
)->
primary
();
$table
->
bigInteger
(
'user_id'
)->
index
();
$table
->
integer
(
'type'
)->
unsigned
()->
default
(
0
);
$table
->
timestamps
();
$table
->
softDeletes
();
$table
->
foreign
(
'user_id'
)->
references
(
'id'
)->
on
(
'users'
)
->
onUpdate
(
'cascade'
)->
onDelete
(
'cascade'
);
}
);
Schema
::
create
(
'fs_properties'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'item_id'
,
36
);
$table
->
string
(
'key'
)->
index
();
$table
->
text
(
'value'
);
$table
->
timestamps
();
$table
->
unique
([
'item_id'
,
'key'
]);
$table
->
foreign
(
'item_id'
)->
references
(
'id'
)->
on
(
'fs_items'
)
->
onDelete
(
'cascade'
)->
onUpdate
(
'cascade'
);
}
);
Schema
::
create
(
'fs_chunks'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'item_id'
,
36
);
$table
->
string
(
'chunk_id'
,
36
);
$table
->
integer
(
'sequence'
)->
default
(
0
);
$table
->
integer
(
'size'
)->
unsigned
()->
default
(
0
);
$table
->
timestamps
();
$table
->
softDeletes
();
$table
->
unique
([
'item_id'
,
'chunk_id'
]);
// $table->unique(['item_id', 'sequence', 'deleted_at']);
$table
->
foreign
(
'item_id'
)->
references
(
'id'
)->
on
(
'fs_items'
)
->
onUpdate
(
'cascade'
)->
onDelete
(
'cascade'
);
}
);
}
/**
* Reverse the migrations.
*/
public
function
down
():
void
{
Schema
::
dropIfExists
(
'fs_properties'
);
Schema
::
dropIfExists
(
'fs_chunks'
);
Schema
::
dropIfExists
(
'fs_items'
);
}
};
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 5:23 AM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387398
Default Alt Text
2022_03_02_100000_create_filesystem_tables.php (2 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment