Closed curder closed 7 years ago
Hi, blog_
is your prefix for all tables?
yes, I defined it in my config file,tablePrefix => blog_
for my database connect params, and I am run php yii migrate/create init_comment_table
to created a new migration for this problem. like this
<?php
use yii\db\Migration;
class m170313_042335_init_comment_table extends Migration
{
const TABLE_NAME = '{{%comment}}';
public function up()
{
echo "m170313_042335_init_comment_table cannot be reverted.\n";
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable(self::TABLE_NAME, [
'id' => $this->primaryKey(),
'entity' => $this->char(10)->notNull(),
'entityId' => $this->integer()->notNull(),
'content' => $this->text()->notNull(),
'parentId' => $this->integer()->null(),
'level' => $this->smallInteger()->notNull()->defaultValue(1),
'createdBy' => $this->integer()->notNull(),
'updatedBy' => $this->integer()->notNull(),
'relatedTo' => $this->string(500)->notNull(),
'url' => $this->text(),
'status' => $this->smallInteger()->notNull()->defaultValue(1),
'createdAt' => $this->integer()->notNull(),
'updatedAt' => $this->integer()->notNull(),
], $tableOptions);
$this->createIndex('idx-comment-entity', self::TABLE_NAME, 'entity');
$this->createIndex('idx-comment-status', self::TABLE_NAME, 'status');
}
public function down()
{
echo "m170313_042335_init_comment_table cannot be reverted.\n";
$this->dropTable(self::TABLE_NAME);
}
}
and solved it, thank you for your answer! Happy Hacking :laugh
Thanks :)
when i run
php yii migrate --migrationPath=@vendor/yii2mod/yii2-comments/migrations
,throw some error, Error Info :My Developer environment is MAMP,and the MySQL version is 5.5.42。
so I modified the my.conf file and restart mysqld server.
the bug is aways ready exists,please tell me some idea to solve it.