Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Unnecessary SQL statement for comment on column in PgSQL #62

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

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

No branches or pull requests

1 participant