You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
869 B
26 lines
869 B
9 years ago
|
<?php
|
||
|
|
||
|
use yii\db\Schema;
|
||
|
use yii\db\Migration;
|
||
|
|
||
|
class m150722_150000_single_tree extends Migration
|
||
|
{
|
||
|
public function up()
|
||
|
{
|
||
|
$tableOptions = null;
|
||
|
if ($this->db->driverName === 'mysql') {
|
||
|
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||
|
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||
|
}
|
||
|
|
||
|
$this->createTable('{{%single_tree}}', [
|
||
|
'id' => Schema::TYPE_PK,
|
||
|
'lft' => Schema::TYPE_INTEGER . ' NOT NULL',
|
||
|
'rgt' => Schema::TYPE_INTEGER . ' NOT NULL',
|
||
|
'depth' => Schema::TYPE_INTEGER . ' NOT NULL',
|
||
|
], $tableOptions);
|
||
|
$this->createIndex('lft', '{{%single_tree}}', ['lft', 'rgt']);
|
||
|
$this->createIndex('rgt', '{{%single_tree}}', ['rgt']);
|
||
|
}
|
||
|
}
|