1. Marcin Kuzminski
  2. RhodeCode
  3. Issues

Issues

Issue #383 invalid

Upgrade to 1.3.x fails - sqlalchemy can't find parent/child relationship for user notifications

IBBoard
created an issue

I just tried updating to v1.3.3 using {{{ pip install --upgrade rhodecode paster make-config RhodeCode production.ini paster upgrade-db production.ini }}} (as listed in the install instructions - http://packages.python.org/RhodeCode/upgrade.html ) but what I end up getting is the following error and stacktrace: {{{

Traceback (most recent call last): File "/usr/bin/paster", line 8, in <module> load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')() File "/usr/lib/python2.6/site-packages/paste/script/command.py", line 104, in run invoke(command, command_name, options, args[1:]) File "/usr/lib/python2.6/site-packages/paste/script/command.py", line 143, in invoke exit_code = runner.run(args) File "/usr/lib/python2.6/site-packages/rhodecode/lib/utils.py", line 597, in run return super(BasePasterCommand, self).run(args[1:]) File "/usr/lib/python2.6/site-packages/paste/script/command.py", line 238, in run result = self.command() File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/init.py", line 59, in command dbmanage.upgrade() File "/usr/lib/python2.6/site-packages/rhodecode/lib/db_manage.py", line 186, in upgrade getattr(UpgradeSteps(self), 'step_%s' % step)() File "/usr/lib/python2.6/site-packages/rhodecode/lib/db_manage.py", line 151, in step_0 api.upgrade(db_uri, repository_path, dbversion) File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/api.py", line 186, in upgrade return migrate(url, repository, version, upgrade=True, err=err, opts) File "<string>", line 2, in _migrate File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/util/init.py", line 159, in with_engine return f(*a, kw) File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/api.py", line 366, in _migrate schema.runchange(ver, change, changeset.step) File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/schema.py", line 91, in runchange change.run(self.engine, step) File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/script/py.py", line 145, in run script_func(engine) File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/versions/003_version_1_2_0.py", line 26, in upgrade Group().table.create() File "<string>", line 2, in init File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/instrumentation.py", line 309, in _new_state_if_none state = self._state_constructor(instance, self) File "/usr/lib64/python2.6/site-packages/sqlalchemy/util/langhelpers.py", line 484, in get obj.dict[self.name] = result = self.fget(obj) File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/instrumentation.py", line 157, in _state_constructor self.dispatch.first_init(self, self.class) File "/usr/lib64/python2.6/site-packages/sqlalchemy/event.py", line 274, in call fn(args, *kw) File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 2936, in _event_on_first_init configure_mappers() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 2861, in configure_mappers mapper._post_configure_properties() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 1166, in _post_configure_properties prop.init() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/interfaces.py", line 128, in init self.do_init() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/properties.py", line 914, in do_init self._determine_joins() File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/properties.py", line 1051, in _determine_joins % self) sqlalchemy.exc.ArgumentError: Could not determine join condition between parent/child tables on relationship User.notifications. Specify a 'primaryjoin' expression. If 'secondary' is present, 'secondaryjoin' is needed as well. }}} I've been poking the code and the database for hours to see if I broke anything in a previous upgrade, but I'm now out of ideas.

For now, {{{pip install rhodecode=1.2.5}}} has recovered my old install, but even going version by version with {{{pip install rhodecode=1.3.0}}} fails with the same error.

Comments (6)

  1. Marcin Kuzminski repo owner

    File "/usr/lib/python2.6/site-packages/rhodecode/lib/dbmigrate/versions/003_version_1_2_0.py", line 26, in upgrade Group().table.create()

    Looks like It's trying to run 1.2.0 migration again, so maybe the previous upgrade didn't bump to proper number ?

    Bottom line is for 1.2.5 you should have version = 3 set in db_migrate_version table. please check this.

  2. IBBoard reporter

    That fixed it - not quite sure how it got into that state, unless a previous update failed. I just couldn't work out from the code quite which steps it should and shouldn't have been trying for an upgrade.

  3. D0centus

    I have the same issue. I'm sorry, but I don't understand what I should to do to resolve this issue? I'm trying to upgrade from 1.1.8 to 1.3.3. And more question: how can I migrate from sqlite to mysql?

  4. IBBoard reporter

    I had to SSH onto the server, "sqlite3 /path/to/rhodecode/rhodecode.sqlite" then run something like "UPDATE db_migrate_version SET version = 3" and re-run the upgrade. If you're only on 1.1.8 then that would be a *bad idea*, though, as version 3 is for 1.2.0.

    What do you get if you manually query the sqlite database with "SELECT * FROM db_migrate_version"?

  5. D0centus

    sqlite> SELECT * FROM db_migrate_version; rhodecode_db_migrations|versions|2

    May be is there a different way to migrate all my projects from old repository to the new?

  6. IBBoard reporter

    Maybe there is a bug in the update. I'd try updating to 1.2.5 to get to to migration version 3 (pip install rhodecode=1.2.5, or whatever options easy_install might give you, and then run the rest of the update process) and then update to 1.3.x.

    If that works then there is a bug going from 1.1.x (which my database thought it was at) to 1.3.x, but not if you go via a properly configured 1.2.x setup.

  7. Log in to comment