Skip to content

Класс для упрощения написания миграций

License

Notifications You must be signed in to change notification settings

andkon13/yii2-migrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Add-on over standard migrations, which automatically creates migration rollback functions.

Надстройка над стандартными миграциями, позволяющая автоматически создавать функции отката миграции.

uses:

class m000000_000000_users extends \andkon\migrate\Migration
{
    public function setTables()
    {
        return [
            'users' => [
                'id'            => $this->primaryKey(),
                'company_id'    => $this->integer()->notNull(),
                'position_id'   => $this->integer(),
                'department_id' => $this->integer(),
                'login'         => $this->string(255)->notNull(),
                'password'      => $this->string(255),
                'password_salt' => $this->string(255),
                'first_name'    => $this->string(255),
                'middle_name'   => $this->string(255),
            ]
        ];
    }
    
    public function setForeignKeys()
    {
        return [
            // user
            [
                'user'    => 'company_id',
                'company' => 'id',
            ],
            [
                'user'     => 'position_id',
                'position' => 'id',
                'delete'   => 'RESTRICT',
            ],
        ];
    }
}

About

Класс для упрощения написания миграций

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages