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

Order of migration statement is incorrect when one PK column is deleted and new one is created #152

Open
SOHELAHMED7 opened this issue Jun 1, 2023 · 0 comments

Comments

@SOHELAHMED7
Copy link
Contributor

See file : yii2-openapi/tests/specs/blog_v2/migrations_pgsql_db/m200000_000000_change_table_v2_posts.php

// after deleting uid this should be executed,
// currently getting error about 2 PK in one table
$this->addColumn('{{%v2_posts}}', 'id', $this->bigPrimaryKey());
$this->execute('CREATE TYPE "enum_itt_v2_posts_lang" AS ENUM(\'ru\', \'eng\')');
$this->addColumn('{{%v2_posts}}', 'lang', '"enum_itt_v2_posts_lang" NULL DEFAULT \'ru\'');
// below should be deleted first
$this->dropColumn('{{%v2_posts}}', 'uid');

Order is incorrect. First previous ID should be deleted. Then new one should be created. This result in failing migration.


priority: very low (as ID column once created are not often deleted)

type: enhancemnet

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

No branches or pull requests

1 participant