Completed
Push — master ( 400589...beb115 )
by Anton
02:32
created

ModuleMedia   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 5 1
A down() 0 5 1
1
<?php
2
/**
3
 * @copyright Bluz PHP Team
4
 * @link https://github.com/bluzphp/skeleton
5
 */
6
7
use Phinx\Migration\AbstractMigration;
8
9
/**
10
 * CreateMediaTable
11
 */
12
class ModuleMedia extends AbstractMigration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
13
{
14
    /**
15
     * Migrate Up.
16
     */
17
    public function up()
18
    {
19
        $this->execute('CREATE TABLE IF NOT EXISTS media (id BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT, userId BIGINT(20) unsigned NOT NULL, module VARCHAR(24) DEFAULT \'users\' NOT NULL, title LONGTEXT, type VARCHAR(24), file VARCHAR(255), thumb VARCHAR(255), size INT(11) unsigned NOT NULL, created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, CONSTRAINT media_users_id_fk FOREIGN KEY (userId) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE);');
20
        $this->execute('REPLACE INTO `acl_privileges` (`roleId`, `module`, `privilege`) VALUES (2,\'media\',\'Management\'), (2,\'media\',\'Upload\'), (3,\'media\',\'Upload\');');
21
    }
22
    /**
23
     * Migrate Down.
24
     */
25
    public function down()
26
    {
27
        $this->dropTable('media');
28
        $this->execute('DELETE FROM `acl_privileges` WHERE module=\'media\'');
29
    }
30
}
31