andkon / yii2-migrate
Class to simplify the writing of migrations
Installs: 8 932
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2025-01-04 20:20:14 UTC
README
Надстройка над стандартными миграциями, позволяющая автоматически создавать функции отката миграции.
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',
],
];
}
}