Skip to content

Unnecessary SQL statement for comment on column in PgSQL #62

Open
@SOHELAHMED7

Description

@SOHELAHMED7

If #61 is merged, it will introduce new unwanted behaviour in migrations for PgSQL:

class m200000_000001_create_table_fruits extends \yii\db\Migration
{
    public function safeUp()
    {
        $this->createTable('{{%fruits}}', [
            'id' => $this->primaryKey(),
            'name' => $this->text()->null()->defaultValue(null)->comment('desc with \' quote'), <---------------------------- see comment here
            0 => '"description" double precision NULL DEFAULT NULL',
        ]);
        $this->addCommentOnColumn('{{%fruits}}', 'name', 'desc with \' quote'); <---------------------------- see comment here too, this is not needed
        $this->addCommentOnColumn('{{%fruits}}', 'description', 'desc \' 2');
    }

This exist due to

  • column such as "description" present in above example.
  • Unlike MySQL, to add/edit comment on column (ALTER COLUMN) in PgSQL, we require separate SQL statement

Also see yiisoft/yii2#19759.


priority: very low

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions