Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F11541781
2020_03_30_100000_create_discounts.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
2020_03_30_100000_create_discounts.php
View Options
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
// phpcs:ignore
class
CreateDiscounts
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'discounts'
,
function
(
Blueprint
$table
)
{
$table
->
string
(
'id'
,
36
);
$table
->
tinyInteger
(
'discount'
)->
unsigned
();
// was json, but mariadb
$table
->
text
(
'description'
);
// end of
$table
->
string
(
'code'
,
32
)->
nullable
();
$table
->
boolean
(
'active'
)->
default
(
false
);
$table
->
timestamp
(
'created_at'
)->
useCurrent
();
$table
->
timestamp
(
'updated_at'
)->
useCurrent
();
$table
->
primary
(
'id'
);
}
);
Schema
::
table
(
'wallets'
,
function
(
Blueprint
$table
)
{
$table
->
string
(
'discount_id'
,
36
)->
nullable
();
$table
->
foreign
(
'discount_id'
)->
references
(
'id'
)
->
on
(
'discounts'
)->
onDelete
(
'set null'
);
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'wallets'
,
function
(
Blueprint
$table
)
{
$table
->
dropForeign
([
'discount_id'
]);
$table
->
dropColumn
(
'discount_id'
);
}
);
Schema
::
dropIfExists
(
'discounts'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Sep 28, 8:49 PM (2 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1414609
Default Alt Text
2020_03_30_100000_create_discounts.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment