https://bugzilla.novell.com/show_bug.cgi?id=874214 https://bugzilla.novell.com/show_bug.cgi?id=874214#c0 Summary: rake db:migrations fail upgrading from 2.3 -> 2.5 Classification: Internal Novell Products Product: openSUSE Build Service Version: 2.5 Platform: x86-64 OS/Version: SLES 11 Status: NEW Severity: Major Priority: P5 - None Component: General AssignedTo: adrian@suse.com ReportedBy: jplautz@cray.com QAContact: adrian@suse.com Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 In performing an upgrade from OBS 2.3.4.1 to 2.5 (this also occurs from 2.4->2.5), multiple of the rake migrations fail due to renamed tables and columns. I've attached my notes that contain the general issues. #5,#7,#8 were all caused as a side effect of fixing the rest. 1) db/migrate/20121120124300_add_owner_root_project_attrib_type.rb fails: can't write unknown attribute `role_id' ISSUE: attrib_type_modifiable_bies column is named "bs_role_id" db/migrate/20131111194720_rename_bs_role.rb renames the column, but that happens far too late in the process to be helpful. 2) db/migrate/20121121142111_watchlist_use_ids.rb Similar issue. Mysql2::Error: Table 'api_production.relationships' doesn't exist: SELECT ur.project_id, ur.user_id from flags f, relationships ur where f.flag = 'access' and f.status = 'disable' and ur.project_id = f.project_id/srv/www/obs/api/app/models/relationship.rb:128:in `block in forbidden_project_ids_for_user' /srv/www/obs/api/app/models/relationship.rb:126:in `forbidden_project_ids_for_user' /srv/www/obs/api/app/models/relationship.rb:122:in `forbidden_project_ids' /srv/www/obs/api/app/models/project.rb:72:in `block in class:Project' /srv/www/obs/api/db/migrate/20121121142111_watchlist_use_ids.rb:6:in `block in up' /srv/www/obs/api/db/migrate/20121121142111_watchlist_use_ids.rb:5:in `up' ISSUE: All of the relationship tables were renamed to a single 'relationships' table. This table creation occurs in db/migrate/20130802183104_create_relationships.rb However the older migrations that call internal functions are now forced to use the new name. The rename needs to be moved earlier in the process. 3) db/migrate/20121121142111_watchlist_use_ids.rb (again) After manually adding the relationships table, the script still fails: Mysql2::Error: Unknown column 'f.project_id' in 'where clause': SELECT ur.project_id, ur.user_id from flags f, relationships ur where f.flag = 'access' and f.status = 'disable' and ur.project_id = f.project_id/srv/www/obs/api/app/models/relationship.rb:128:in `block in forbidden_project_ids_for_user' /srv/www/obs/api/app/models/relationship.rb:126:in `forbidden_project_ids_for_user' /srv/www/obs/api/app/models/relationship.rb:122:in `forbidden_project_ids' /srv/www/obs/api/app/models/project.rb:72:in `block in class:Project' /srv/www/obs/api/db/migrate/20121121142111_watchlist_use_ids.rb:6:in `block in up' /srv/www/obs/api/db/migrate/20121121142111_watchlist_use_ids.rb:5:in `up' ISSUE: The flags table had db_project_id renamed to project_id. This migration again occurs much later in db/migrate/20131123113417_get_rid_of_db_prefix.rb After manually performing the steps in that file this succeeded. 4) db/migrate/20130626160000_attribute_issue_marker.rb unknown attribute: bs_role_id/srv/www/obs/api/db/migrate/20130626160000_attribute_issue_marker.rb:10:in `up' ISSUE: Now that all of the previous renames were done manually to get us this far, some of the intermediate migrations are still using the old names. They need to be updated with proper names. 5) db/migrate/20130802183104_create_relationships.rb ISSUE: Having created the relationships table earlier to solve #2, the actual migration failed. Self inflicted to be sure. This migration needs to be moved earlier. 6) db/migrate/20131023063641_add_obs_branch_repositories_attribute.rb unknown attribute: bs_role_id ISSUE: In fixing #1, subsequent migrations use the wrong names. Same as #4. 7) db/migrate/20131111194720_rename_bs_role.rb ISSUE: Same as #5. Needed to do this manually to fix #1. 8) db/migrate/20131123113417_get_rid_of_db_prefix.rb ISSUE: Same as #5. Needed to do this manually to fix #3. Reproducible: Always Steps to Reproduce: 1. Install 2.3 or 2.4 2. rake db:migrate -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.