|
|
|
@ -42,38 +42,38 @@ class m140506_102106_rbac_init extends \yii\db\Migration
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->createTable($authManager->ruleTable, [ |
|
|
|
|
'name' => Schema::TYPE_STRING . '(64) NOT NULL', |
|
|
|
|
'data' => Schema::TYPE_TEXT, |
|
|
|
|
'created_at' => Schema::TYPE_INTEGER, |
|
|
|
|
'updated_at' => Schema::TYPE_INTEGER, |
|
|
|
|
'name' => Schema::string(64)->notNull(), |
|
|
|
|
'data' => Schema::text(), |
|
|
|
|
'created_at' => Schema::integer(), |
|
|
|
|
'updated_at' => Schema::integer(), |
|
|
|
|
'PRIMARY KEY (name)', |
|
|
|
|
], $tableOptions); |
|
|
|
|
|
|
|
|
|
$this->createTable($authManager->itemTable, [ |
|
|
|
|
'name' => Schema::TYPE_STRING . '(64) NOT NULL', |
|
|
|
|
'type' => Schema::TYPE_INTEGER . ' NOT NULL', |
|
|
|
|
'description' => Schema::TYPE_TEXT, |
|
|
|
|
'rule_name' => Schema::TYPE_STRING . '(64)', |
|
|
|
|
'data' => Schema::TYPE_TEXT, |
|
|
|
|
'created_at' => Schema::TYPE_INTEGER, |
|
|
|
|
'updated_at' => Schema::TYPE_INTEGER, |
|
|
|
|
'name' => Schema::string(64)->notNull(), |
|
|
|
|
'type' => Schema::integer()->notNull(), |
|
|
|
|
'description' => Schema::text(), |
|
|
|
|
'rule_name' => Schema::string(64), |
|
|
|
|
'data' => Schema::text(), |
|
|
|
|
'created_at' => Schema::integer(), |
|
|
|
|
'updated_at' => Schema::integer(), |
|
|
|
|
'PRIMARY KEY (name)', |
|
|
|
|
'FOREIGN KEY (rule_name) REFERENCES ' . $authManager->ruleTable . ' (name) ON DELETE SET NULL ON UPDATE CASCADE', |
|
|
|
|
], $tableOptions); |
|
|
|
|
$this->createIndex('idx-auth_item-type', $authManager->itemTable, 'type'); |
|
|
|
|
|
|
|
|
|
$this->createTable($authManager->itemChildTable, [ |
|
|
|
|
'parent' => Schema::TYPE_STRING . '(64) NOT NULL', |
|
|
|
|
'child' => Schema::TYPE_STRING . '(64) NOT NULL', |
|
|
|
|
'parent' => Schema::string(64)->notNull(), |
|
|
|
|
'child' => Schema::string(64)->notNull(), |
|
|
|
|
'PRIMARY KEY (parent, child)', |
|
|
|
|
'FOREIGN KEY (parent) REFERENCES ' . $authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE', |
|
|
|
|
'FOREIGN KEY (child) REFERENCES ' . $authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE', |
|
|
|
|
], $tableOptions); |
|
|
|
|
|
|
|
|
|
$this->createTable($authManager->assignmentTable, [ |
|
|
|
|
'item_name' => Schema::TYPE_STRING . '(64) NOT NULL', |
|
|
|
|
'user_id' => Schema::TYPE_STRING . '(64) NOT NULL', |
|
|
|
|
'created_at' => Schema::TYPE_INTEGER, |
|
|
|
|
'item_name' => Schema::string(64)->notNull(), |
|
|
|
|
'user_id' => Schema::string(64)->notNull(), |
|
|
|
|
'created_at' => Schema::integer(), |
|
|
|
|
'PRIMARY KEY (item_name, user_id)', |
|
|
|
|
'FOREIGN KEY (item_name) REFERENCES ' . $authManager->itemTable . ' (name) ON DELETE CASCADE ON UPDATE CASCADE', |
|
|
|
|
], $tableOptions); |
|
|
|
|