Support #5496
opendatabase migration 4.11.6 mysql to 4.12.4 postgres
0%
Description
Stand up a new 4.12.4 using postgres
Migrate data from 4.11.6 using mysql to this new 4.12.4 using postgres
The migration was done by following:
https://community.rhodecode.com/t/rhodecode-sqlite-to-postgresql-migration/31
and making adjustments as necessary.
It seem to be working in my test environment and will soon need to be repeated in the production environment.
There is an anomoly I ran across today so I am looking for a way to fix it:
Admin->settings->system-info
Database:postgresql://rcuser:***@127.0.0.1:5432/rhodecode @ migration version: 85
Critical: database schema mismatch, expected version 86, got 85. Please run migrations on your database.
Database version:postgresql 9.2.23
Critical: database schema mismatch, expected version 86, got 85. Please run migrations on your database.
So I ran:
.rccontrol/enterprise-1/profile/bin/rc-upgrade-db .rccontrol/enterprise-1/rhodecode.ini
.
.
.
2018-08-27 14:33:53.946 [10844] INFO [rhodecode.lib.dbmigrate.migrate.versioning.api] 85 -> 86...
*** SQLA BASE RESET ! ***
2018-08-27 14:33:54,085 INFO sqlalchemy.engine.base.Engine
ALTER TABLE repositories ADD push_uri TEXT
2018-08-27 14:33:54,085 INFO sqlalchemy.engine.base.Engine {}
2018-08-27 14:33:54,098 INFO sqlalchemy.engine.base.Engine ROLLBACK
Traceback (most recent call last):
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/bin/..rc-upgrade-db-wrapped-wrapped", line 12, in
sys.exit(main())
File "/opt/rhodecode/store/srlrc8ph6yk4yxp9lmbmvbsv6ln5f5r4-python2.7-click-6.6/lib/python2.7/site-packages/click/core.py", line 716, in call
return self.main(*args, **kwargs)
File "/opt/rhodecode/store/srlrc8ph6yk4yxp9lmbmvbsv6ln5f5r4-python2.7-click-6.6/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/opt/rhodecode/store/srlrc8ph6yk4yxp9lmbmvbsv6ln5f5r4-python2.7-click-6.6/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/rhodecode/store/srlrc8ph6yk4yxp9lmbmvbsv6ln5f5r4-python2.7-click-6.6/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/rc_commands/upgrade_db.py", line 37, in main
return command(ini_path, force_yes)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/rc_commands/upgrade_db.py", line 52, in command
dbmanage.upgrade()
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/db_manage.py", line 188, in upgrade
api.upgrade(db_uri, repository_path, step)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/api.py", line 188, in upgrade
return migrate(url, repository, version, upgrade=True, err=err, **opts)
File "", line 2, in _migrate
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/util/init_.py", line 159, in with_engine
return f(*a, **kw)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/api.py", line 368, in _migrate
schema.runchange(ver, change, changeset.step)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/schema.py", line 92, in runchange
change.run(self.engine, step)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/versioning/script/py.py", line 144, in run
script_func(engine)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/versions/086_version_4_12_0.py", line 25, in upgrade
push_uri.create(table=repository_table)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/changeset/schema.py", line 535, in create
engine._run_visitor(visitorcallable, self, connection, **kwargs)
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1929, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1538, in _run_visitor
**kwargs).traverse_single(element)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py", line 56, in traverse_single
ret = super(AlterTableVisitor, self).traverse_single(elem)
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py", line 105, in visit_column
self.execute()
File "/opt/rhodecode/store/486i3n39w3q46fjw74fgndkhzb6x50zp-python2.7-rhodecode-enterprise-ce-4.12.4/lib/python2.7/site-packages/rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py", line 44, in execute
return self.connection.execute(self.buffer.getvalue())
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 939, in execute
return self._execute_text(object, multiparams, params)
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1097, in _execute_text
statement, parameters
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
exc_info
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/opt/rhodecode/store/knphb4bx7g4ps5qnnb68cnsflphqb488-python2.7-SQLAlchemy-1.1.15/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column "push_uri" of relation "repositories" already exists
[SQL: '\nALTER TABLE repositories ADD push_uri TEXT']
Updated by Marcin Kuzminski [CTO] about 6 years ago
Step 86 only adds that column, I guess if you have it already then you should manually bump the version in the database to 86.
The reason it happened was that the database data was transfered for 4.11 version and the new PG version was 4.12 (which added that 1 column) The process should be done from the same versions, so 4.11.X should be first upgraded to 4.12 and then database migration should happen.
Updated by Stephen Serafin about 6 years ago
Thanks, I'll adjust my process to upgrade the source instance before migration.