Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

In Pgsql, column data type change from varchar(255) to json "using" should be used #125

Closed
SOHELAHMED7 opened this issue Dec 30, 2022 · 0 comments · Fixed by SOHELAHMED7/yii2-openapi#7

Comments

@SOHELAHMED7
Copy link
Contributor

In Pgsql, if we change db type from varchar(255) to json, alter column statement should have "using".

Example:

From:

name:
          type: string
          x-db-type: varchar(255)

To:

name:
          type: array
          x-db-type: JSON
          nullable: false
          default: '{}'

This should not be generated in migration:

$this->db->createCommand('ALTER TABLE {{%fruits}} ALTER COLUMN name SET DATA TYPE json')->execute();

But this should be generated:

$this->db->createCommand('ALTER TABLE {{%fruits}} ALTER COLUMN name SET DATA TYPE json using "name"::json')->execute();

PR will be SOHELAHMED7#7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant