I
I
ioseogio2020-05-12 21:50:17
Yii
ioseogio, 2020-05-12 21:50:17

Where can I find RBAC migrations for mongoDB?

All guides refer to RBAC migrations for mysql.

There is an authManager - yii\mongodb\rbac\MongoDbManager
Accordingly, it needs the same RBAC tables as for yii\rbac\DbManager

I dug through the folders and again found migrations only for mysql

Are there already created migrations for mongoDB or will I have to write it myself ?
If there are, where can they be found?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-05-12
@ioseogio

Abstract Class yii\mongodb\Migration

class m160719_140557_dialogs extends \yii\mongodb\Migration
{
    public function init()
    {
        $this->db = Yii::$app->mongodb;
        parent::init();
    }

    public function up()
    {

        $this->createCollection('dialogs',['users_id' => [],'settings' => []]);
        $this->createIndex('dialogs',['users_id']);
    }

    public function down()
    {
        $this->dropCollection('dialogs',['users_id' => [],'settings' => []]);
    }
}

If different DBs can be specified in init which one to work with.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question