Giter Site home page Giter Site logo

Comments (3)

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

Hi, blog_ is your prefix for all tables?

from yii2-comments.

curder avatar curder commented on May 23, 2024

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

from yii2-comments.

ihorchepurnyi avatar ihorchepurnyi commented on May 23, 2024

Thanks :)

from yii2-comments.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.