db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%friend}}', [ 'owner_id' => $this->integer()->notNull()->comment('自己'), 'friend_id' => $this->integer()->notNull()->comment('朋友'), 'created_at' => $this->integer()->notNull(), 'updated_at' => $this->integer()->notNull(), ], $tableOptions); $this->createIndex('friend', '{{%friend}}', ['owner_id', 'friend_id'], true); } /** * @inheritdoc */ public function down() { $this->dropTable('{{%friend}}'); } }