The current app runs on MySQL and thinking about switching to PostgreSQL.
On running migration scripts, it dies at statement to to alter a column to unique.
Code in migration script:
$this->alterColumn({{%table}}, ‘id’, $this->string(50)->unique());
The sql causing error:
ALTER TABLE “table” ALTER COLUMN “id” TYPE varchar(50) UNIQUE’
The syntax in psql should be in format:
ALTER TABLE the_table ADD CONSTRAINT constraint_name UNIQUE (thecolumn);
Is this a bug or is there a way to fix so that the same code can run on both mysql and pgsql?