Skip to content

Unnecessary SQL statement for comment on column in PgSQL #62

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
SOHELAHMED7 opened this issue Oct 3, 2024 · 0 comments
Open

Unnecessary SQL statement for comment on column in PgSQL #62

SOHELAHMED7 opened this issue Oct 3, 2024 · 0 comments

Comments

@SOHELAHMED7
Copy link
Member

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant