yii2 mongodb Создание коллекции -- пример миграции
Primary tabs
Например:
<?php class m160303_154032_create_data_collection extends \yii\mongodb\Migration { private $collection = 'data'; public function up() { $this->createCollection($this->collection); $this->createIndex($this->collection, 'user_id'); $this->createIndex($this->collection, 'message_id'); } public function down() { $this->dropIndex($this->collection, 'message_id'); $this->dropIndex($this->collection, 'user_id'); $this->dropCollection($this->collection); } }
- Log in to post comments
- 4831 reads