Passed
Pull Request — master (#75)
by Korotkov
12:47
created

Users_21012021130204_migration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 18 1
1
<?php
2
3
namespace App\Ship\Migration;
4
5
use Rudra\Container\Facades\Rudra;
6
7
class Users_21012021130204_migration
8
{
9
    public function up(): void
10
    {
11
        $table = "users";
12
13
        $query = Rudra::get("DSN")->prepare("
14
            CREATE TABLE {$table} ( 
15
            `id` INT NOT NULL AUTO_INCREMENT ,
16
            `name` VARCHAR(255) NOT NULL , 
17
            `email` VARCHAR(255) NOT NULL , 
18
            `password` VARCHAR(255) NOT NULL ,
19
            `role` VARCHAR(255) NOT NULL ,
20
            `status` VARCHAR(255) NOT NULL ,
21
            `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
22
            `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
23
             PRIMARY KEY (`id`)) ENGINE = InnoDB
24
         ");
25
26
        $query->execute();
27
    }
28
}