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

ModuleMedia::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
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