[ https://issues.apache.org/jira/browse/CAY-2154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15693257#comment-15693257 ]
ASF GitHub Bot commented on CAY-2154: ------------------------------------- GitHub user stariy95 opened a pull request: https://github.com/apache/cayenne/pull/142 CAY-2154 Migrate db: queries order Fix ensure this ordering: - Add column before add foreign key - Drop foreign key before drop column You can merge this pull request into a Git repository by running: $ git pull https://github.com/stariy95/cayenne CAY-2154 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cayenne/pull/142.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #142 ---- commit 8e5dab5763f68ff762d175a76511c3dfc0a83084 Author: Nikita Timofeev <stari...@gmail.com> Date: 2016-11-24T13:05:30Z CAY-2154 Migrate db: queries order Fix ensure this ordering: - Add column before add foreign key - Drop foreign key before drop column ---- > Migrate db: queries order > ------------------------- > > Key: CAY-2154 > URL: https://issues.apache.org/jira/browse/CAY-2154 > Project: Cayenne > Issue Type: Bug > Components: Modeler > Affects Versions: 4.0.M4 > Reporter: ana benko > Assignee: Nikita Timofeev > > 1. Reverse Engineer db, that has eg. Salary dbEntity > 2. Add eg. dept_id column to Salary > 3. Add new Dept dbEntity, add id column > 4. Join Salary and Dept entities by 1->many relationship. Save > 5. Migrate Db, view Generated SQL tab > -> migrate first attempts to create FK, and only then adds new column > ALTER TABLE testdb.salary ADD FOREIGN KEY (dept_id) REFERENCES dept (id); > ALTER TABLE testdb.salary ADD COLUMN dept_id INT; > which results in a error -- This message was sent by Atlassian JIRA (v6.3.4#6332)