diff --git a/rhodecode/lib/db_manage.py b/rhodecode/lib/db_manage.py --- a/rhodecode/lib/db_manage.py +++ b/rhodecode/lib/db_manage.py @@ -1,8 +1,15 @@ -#!/usr/bin/env python -# encoding: utf-8 -# database management for RhodeCode -# Copyright (C) 2009-2010 Marcin Kuzminski -# +# -*- coding: utf-8 -*- +""" + rhodecode.lib.db_manage + ~~~~~~~~~~~~~~~~~~~~~~~ + + Database creation, and setup module for RhodeCode + + :created_on: Apr 10, 2010 + :author: marcink + :copyright: (C) 2009-2010 Marcin Kuzminski + :license: GPLv3, see COPYING for more details. +""" # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 @@ -18,25 +25,24 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. -""" -Created on April 10, 2010 -database management and creation for RhodeCode -@author: marcink -""" - -from os.path import dirname as dn, join as jn import os import sys import uuid +import logging +from os.path import dirname as dn, join as jn + +from rhodecode import __dbversion__ +from rhodecode.model.db import +from rhodecode.model import meta from rhodecode.lib.auth import get_crypt_password from rhodecode.lib.utils import ask_ok from rhodecode.model import init_model from rhodecode.model.db import User, Permission, RhodeCodeUi, RhodeCodeSettings, \ - UserToPerm -from rhodecode.model import meta + UserToPerm, DbMigrateVersion + from sqlalchemy.engine import create_engine -import logging + log = logging.getLogger(__name__) @@ -83,8 +89,6 @@ class DbManage(object): def set_db_version(self): - from rhodecode import __dbversion__ - from rhodecode.model.db import DbMigrateVersion try: ver = DbMigrateVersion() ver.version = __dbversion__ diff --git a/rhodecode/lib/dbmigrate/__init__.py b/rhodecode/lib/dbmigrate/__init__.py --- a/rhodecode/lib/dbmigrate/__init__.py +++ b/rhodecode/lib/dbmigrate/__init__.py @@ -25,10 +25,14 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. -from rhodecode.lib.utils import BasePasterCommand +import logging +from sqlalchemy import engine_from_config + +from rhodecode.lib.dbmigrate.migrate.exceptions import \ + DatabaseNotControlledError from rhodecode.lib.utils import BasePasterCommand, Command, add_cache -from sqlalchemy import engine_from_config +log = logging.getLogger(__name__) class UpgradeDb(BasePasterCommand): """Command used for paster to upgrade our database to newer version @@ -46,10 +50,24 @@ class UpgradeDb(BasePasterCommand): def command(self): from pylons import config add_cache(config) - engine = engine_from_config(config, 'sqlalchemy.db1.') - print engine - raise NotImplementedError('Not implemented yet') + #engine = engine_from_config(config, 'sqlalchemy.db1.') + #rint engine + + from rhodecode.lib.dbmigrate.migrate.versioning import api + path = 'rhodecode/lib/dbmigrate' + + try: + curr_version = api.db_version(config['sqlalchemy.db1.url'], path) + msg = ('Found current database under version' + ' control with version %s' % curr_version) + + except (RuntimeError, DatabaseNotControlledError), e: + curr_version = 0 + msg = ('Current database is not under version control setting' + ' as version %s' % curr_version) + + print msg def update_parser(self): self.parser.add_option('--sql', diff --git a/rhodecode/lib/dbmigrate/migrate.cfg b/rhodecode/lib/dbmigrate/migrate.cfg new file mode 100644 --- /dev/null +++ b/rhodecode/lib/dbmigrate/migrate.cfg @@ -0,0 +1,20 @@ +[db_settings] +# Used to identify which repository this database is versioned under. +# You can use the name of your project. +repository_id=rhodecode_db_migrations + +# The name of the database table used to track the schema version. +# This name shouldn't already be used by your project. +# If this is changed once a database is under version control, you'll need to +# change the table name in each database too. +version_table=db_migrate_version + +# When committing a change script, Migrate will attempt to generate the +# sql for all supported databases; normally, if one of them fails - probably +# because you don't have that database installed - it is ignored and the +# commit continues, perhaps ending successfully. +# Databases in this list MUST compile successfully during a commit, or the +# entire commit will fail. List the databases your application will actually +# be using to ensure your updates to that database work properly. +# This must be a list; example: ['postgres','sqlite'] +required_dbs=['sqlite'] diff --git a/rhodecode/lib/dbmigrate/migrate/__init__.py b/rhodecode/lib/dbmigrate/migrate/__init__.py --- a/rhodecode/lib/dbmigrate/migrate/__init__.py +++ b/rhodecode/lib/dbmigrate/migrate/__init__.py @@ -5,5 +5,5 @@ using Python. """ -from migrate.versioning import * -from migrate.changeset import * +from rhodecode.lib.dbmigrate.migrate.versioning import * +from rhodecode.lib.dbmigrate.migrate.changeset import * diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/__init__.py b/rhodecode/lib/dbmigrate/migrate/changeset/__init__.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/__init__.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/__init__.py @@ -18,8 +18,8 @@ SQLA_06 = _sa_version >= (0, 6) del re del _sa_version -from migrate.changeset.schema import * -from migrate.changeset.constraint import * +from rhodecode.lib.dbmigrate.migrate.changeset.schema import * +from rhodecode.lib.dbmigrate.migrate.changeset.constraint import * sqlalchemy.schema.Table.__bases__ += (ChangesetTable, ) sqlalchemy.schema.Column.__bases__ += (ChangesetColumn, ) diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py b/rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/ansisql.py @@ -16,8 +16,8 @@ from sqlalchemy.schema import (ForeignKe UniqueConstraint, Index) -from migrate import exceptions -from migrate.changeset import constraint, SQLA_06 +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.changeset import constraint, SQLA_06 if not SQLA_06: from sqlalchemy.sql.compiler import SchemaGenerator, SchemaDropper diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/constraint.py b/rhodecode/lib/dbmigrate/migrate/changeset/constraint.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/constraint.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/constraint.py @@ -3,8 +3,8 @@ """ from sqlalchemy import schema -from migrate.exceptions import * -from migrate.changeset import SQLA_06 +from rhodecode.lib.dbmigrate.migrate.exceptions import * +from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_06 class ConstraintChangeset(object): """Base class for Constraint classes.""" @@ -27,7 +27,7 @@ class ConstraintChangeset(object): def __do_imports(self, visitor_name, *a, **kw): engine = kw.pop('engine', self.table.bind) - from migrate.changeset.databases.visitor import (get_engine_visitor, + from rhodecode.lib.dbmigrate.migrate.changeset.databases.visitor import (get_engine_visitor, run_single_visitor) visitorcallable = get_engine_visitor(engine, visitor_name) run_single_visitor(engine, visitorcallable, self, *a, **kw) diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/databases/firebird.py b/rhodecode/lib/dbmigrate/migrate/changeset/databases/firebird.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/databases/firebird.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/databases/firebird.py @@ -3,8 +3,8 @@ """ from sqlalchemy.databases import firebird as sa_base -from migrate import exceptions -from migrate.changeset import ansisql, SQLA_06 +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.changeset import ansisql, SQLA_06 if SQLA_06: diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/databases/mysql.py b/rhodecode/lib/dbmigrate/migrate/changeset/databases/mysql.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/databases/mysql.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/databases/mysql.py @@ -5,8 +5,8 @@ from sqlalchemy.databases import mysql as sa_base from sqlalchemy import types as sqltypes -from migrate import exceptions -from migrate.changeset import ansisql, SQLA_06 +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.changeset import ansisql, SQLA_06 if not SQLA_06: diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/databases/oracle.py b/rhodecode/lib/dbmigrate/migrate/changeset/databases/oracle.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/databases/oracle.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/databases/oracle.py @@ -4,8 +4,8 @@ import sqlalchemy as sa from sqlalchemy.databases import oracle as sa_base -from migrate import exceptions -from migrate.changeset import ansisql, SQLA_06 +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.changeset import ansisql, SQLA_06 if not SQLA_06: diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/databases/postgres.py b/rhodecode/lib/dbmigrate/migrate/changeset/databases/postgres.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/databases/postgres.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/databases/postgres.py @@ -3,7 +3,7 @@ .. _`PostgreSQL`: http://www.postgresql.org/ """ -from migrate.changeset import ansisql, SQLA_06 +from rhodecode.lib.dbmigrate.migrate.changeset import ansisql, SQLA_06 if not SQLA_06: from sqlalchemy.databases import postgres as sa_base diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/databases/sqlite.py b/rhodecode/lib/dbmigrate/migrate/changeset/databases/sqlite.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/databases/sqlite.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/databases/sqlite.py @@ -8,8 +8,8 @@ from copy import copy from sqlalchemy.databases import sqlite as sa_base -from migrate import exceptions -from migrate.changeset import ansisql, SQLA_06 +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.changeset import ansisql, SQLA_06 if not SQLA_06: diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/databases/visitor.py b/rhodecode/lib/dbmigrate/migrate/changeset/databases/visitor.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/databases/visitor.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/databases/visitor.py @@ -3,8 +3,8 @@ """ import sqlalchemy as sa -from migrate.changeset import ansisql -from migrate.changeset.databases import (sqlite, +from rhodecode.lib.dbmigrate.migrate.changeset import ansisql +from rhodecode.lib.dbmigrate.migrate.changeset.databases import (sqlite, postgres, mysql, oracle, diff --git a/rhodecode/lib/dbmigrate/migrate/changeset/schema.py b/rhodecode/lib/dbmigrate/migrate/changeset/schema.py --- a/rhodecode/lib/dbmigrate/migrate/changeset/schema.py +++ b/rhodecode/lib/dbmigrate/migrate/changeset/schema.py @@ -10,9 +10,9 @@ import sqlalchemy from sqlalchemy.schema import ForeignKeyConstraint from sqlalchemy.schema import UniqueConstraint -from migrate.exceptions import * -from migrate.changeset import SQLA_06 -from migrate.changeset.databases.visitor import (get_engine_visitor, +from rhodecode.lib.dbmigrate.migrate.exceptions import * +from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_06 +from rhodecode.lib.dbmigrate.migrate.changeset.databases.visitor import (get_engine_visitor, run_single_visitor) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/api.py b/rhodecode/lib/dbmigrate/migrate/versioning/api.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/api.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/api.py @@ -29,10 +29,10 @@ import sys import inspect import logging -from migrate import exceptions -from migrate.versioning import (repository, schema, version, +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning import (repository, schema, version, script as script_) # command name conflict -from migrate.versioning.util import catch_known_errors, with_engine +from rhodecode.lib.dbmigrate.migrate.versioning.util import catch_known_errors, with_engine log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/cfgparse.py b/rhodecode/lib/dbmigrate/migrate/versioning/cfgparse.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/cfgparse.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/cfgparse.py @@ -4,8 +4,8 @@ from ConfigParser import ConfigParser -from migrate.versioning.config import * -from migrate.versioning import pathed +from rhodecode.lib.dbmigrate.migrate.versioning.config import * +from rhodecode.lib.dbmigrate.migrate.versioning import pathed class Parser(ConfigParser): diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/genmodel.py b/rhodecode/lib/dbmigrate/migrate/versioning/genmodel.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/genmodel.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/genmodel.py @@ -11,9 +11,8 @@ import logging import sqlalchemy -import migrate -import migrate.changeset - +from rhodecode.lib.dbmigrate import migrate +from rhodecode.lib.dbmigrate.migrate import changeset log = logging.getLogger(__name__) HEADER = """ @@ -112,17 +111,17 @@ class ModelGenerator(object): out.append(")") return out - def _get_tables(self,missingA=False,missingB=False,modified=False): + def _get_tables(self, missingA=False, missingB=False, modified=False): to_process = [] - for bool_,names,metadata in ( - (missingA,self.diff.tables_missing_from_A,self.diff.metadataB), - (missingB,self.diff.tables_missing_from_B,self.diff.metadataA), - (modified,self.diff.tables_different,self.diff.metadataA), + for bool_, names, metadata in ( + (missingA, self.diff.tables_missing_from_A, self.diff.metadataB), + (missingB, self.diff.tables_missing_from_B, self.diff.metadataA), + (modified, self.diff.tables_different, self.diff.metadataA), ): if bool_: for name in names: yield metadata.tables.get(name) - + def toPython(self): """Assume database is current and model is empty.""" out = [] @@ -138,10 +137,10 @@ class ModelGenerator(object): def toUpgradeDowngradePython(self, indent=' '): ''' Assume model is most current and database is out-of-date. ''' - decls = ['from migrate.changeset import schema', + decls = ['from rhodecode.lib.dbmigrate.migrate.changeset import schema', 'meta = MetaData()'] for table in self._get_tables( - missingA=True,missingB=True,modified=True + missingA=True, missingB=True, modified=True ): decls.extend(self.getTableDefn(table)) @@ -182,7 +181,7 @@ class ModelGenerator(object): '\n'.join([pre_command] + ['%s%s' % (indent, line) for line in upgradeCommands]), '\n'.join([pre_command] + ['%s%s' % (indent, line) for line in downgradeCommands])) - def _db_can_handle_this_change(self,td): + def _db_can_handle_this_change(self, td): if (td.columns_missing_from_B and not td.columns_missing_from_A and not td.columns_different): @@ -208,9 +207,9 @@ class ModelGenerator(object): dbTable = self.diff.metadataB.tables[tableName] td = self.diff.tables_different[tableName] - + if self._db_can_handle_this_change(td): - + for col in td.columns_missing_from_B: modelTable.columns[col].create() for col in td.columns_missing_from_A: diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/pathed.py b/rhodecode/lib/dbmigrate/migrate/versioning/pathed.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/pathed.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/pathed.py @@ -6,9 +6,9 @@ import os import shutil import logging -from migrate import exceptions -from migrate.versioning.config import * -from migrate.versioning.util import KeyedInstance +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning.config import * +from rhodecode.lib.dbmigrate.migrate.versioning.util import KeyedInstance log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/repository.py b/rhodecode/lib/dbmigrate/migrate/versioning/repository.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/repository.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/repository.py @@ -9,10 +9,10 @@ import logging from pkg_resources import resource_filename from tempita import Template as TempitaTemplate -from migrate import exceptions -from migrate.versioning import version, pathed, cfgparse -from migrate.versioning.template import Template -from migrate.versioning.config import * +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning import version, pathed, cfgparse +from rhodecode.lib.dbmigrate.migrate.versioning.template import Template +from rhodecode.lib.dbmigrate.migrate.versioning.config import * log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/schema.py b/rhodecode/lib/dbmigrate/migrate/versioning/schema.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/schema.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/schema.py @@ -10,11 +10,11 @@ from sqlalchemy.sql import and_ from sqlalchemy import exceptions as sa_exceptions from sqlalchemy.sql import bindparam -from migrate import exceptions -from migrate.versioning import genmodel, schemadiff -from migrate.versioning.repository import Repository -from migrate.versioning.util import load_model -from migrate.versioning.version import VerNum +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning import genmodel, schemadiff +from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository +from rhodecode.lib.dbmigrate.migrate.versioning.util import load_model +from rhodecode.lib.dbmigrate.migrate.versioning.version import VerNum log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py b/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/schemadiff.py @@ -5,7 +5,7 @@ import logging import sqlalchemy -from migrate.changeset import SQLA_06 +from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_06 from sqlalchemy.types import Float log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/script/__init__.py b/rhodecode/lib/dbmigrate/migrate/versioning/script/__init__.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/script/__init__.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/script/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from migrate.versioning.script.base import BaseScript -from migrate.versioning.script.py import PythonScript -from migrate.versioning.script.sql import SqlScript +from rhodecode.lib.dbmigrate.migrate.versioning.script.base import BaseScript +from rhodecode.lib.dbmigrate.migrate.versioning.script.py import PythonScript +from rhodecode.lib.dbmigrate.migrate.versioning.script.sql import SqlScript diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/script/base.py b/rhodecode/lib/dbmigrate/migrate/versioning/script/base.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/script/base.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/script/base.py @@ -2,9 +2,9 @@ # -*- coding: utf-8 -*- import logging -from migrate import exceptions -from migrate.versioning.config import operations -from migrate.versioning import pathed +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning.config import operations +from rhodecode.lib.dbmigrate.migrate.versioning import pathed log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/script/py.py b/rhodecode/lib/dbmigrate/migrate/versioning/script/py.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/script/py.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/script/py.py @@ -6,13 +6,13 @@ import warnings import logging from StringIO import StringIO -import migrate -from migrate.versioning import genmodel, schemadiff -from migrate.versioning.config import operations -from migrate.versioning.template import Template -from migrate.versioning.script import base -from migrate.versioning.util import import_path, load_model, with_engine -from migrate.exceptions import MigrateDeprecationWarning, InvalidScriptError, ScriptError +from rhodecode.lib.dbmigrate import migrate +from rhodecode.lib.dbmigrate.migrate.versioning import genmodel, schemadiff +from rhodecode.lib.dbmigrate.migrate.versioning.config import operations +from rhodecode.lib.dbmigrate.migrate.versioning.template import Template +from rhodecode.lib.dbmigrate.migrate.versioning.script import base +from rhodecode.lib.dbmigrate.migrate.versioning.util import import_path, load_model, with_engine +from rhodecode.lib.dbmigrate.migrate.exceptions import MigrateDeprecationWarning, InvalidScriptError, ScriptError log = logging.getLogger(__name__) __all__ = ['PythonScript'] @@ -49,10 +49,10 @@ class PythonScript(base.BaseScript): :returns: Upgrade / Downgrade script :rtype: string """ - + if isinstance(repository, basestring): # oh dear, an import cycle! - from migrate.versioning.repository import Repository + from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository repository = Repository(repository) oldmodel = load_model(oldmodel) @@ -65,7 +65,7 @@ class PythonScript(base.BaseScript): excludeTables=[repository.version_table]) # TODO: diff can be False (there is no difference?) decls, upgradeCommands, downgradeCommands = \ - genmodel.ModelGenerator(diff,engine).toUpgradeDowngradePython() + genmodel.ModelGenerator(diff, engine).toUpgradeDowngradePython() # Store differences into file. src = Template(opts.pop('templates_path', None)).get_script(opts.pop('templates_theme', None)) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/script/sql.py b/rhodecode/lib/dbmigrate/migrate/versioning/script/sql.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/script/sql.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/script/sql.py @@ -3,8 +3,8 @@ import logging import shutil -from migrate.versioning.script import base -from migrate.versioning.template import Template +from rhodecode.lib.dbmigrate.migrate.versioning.script import base +from rhodecode.lib.dbmigrate.migrate.versioning.template import Template log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/shell.py b/rhodecode/lib/dbmigrate/migrate/versioning/shell.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/shell.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/shell.py @@ -8,10 +8,10 @@ import inspect import logging from optparse import OptionParser, BadOptionError -from migrate import exceptions -from migrate.versioning import api -from migrate.versioning.config import * -from migrate.versioning.util import asbool +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning import api +from rhodecode.lib.dbmigrate.migrate.versioning.config import * +from rhodecode.lib.dbmigrate.migrate.versioning.util import asbool alias = dict( diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/template.py b/rhodecode/lib/dbmigrate/migrate/versioning/template.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/template.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/template.py @@ -7,8 +7,8 @@ import sys from pkg_resources import resource_filename -from migrate.versioning.config import * -from migrate.versioning import pathed +from rhodecode.lib.dbmigrate.migrate.versioning.config import * +from rhodecode.lib.dbmigrate.migrate.versioning import pathed class Collection(pathed.Pathed): @@ -34,7 +34,7 @@ class SQLScriptCollection(Collection): class Template(pathed.Pathed): """Finds the paths/packages of various Migrate templates. - :param path: Templates are loaded from migrate package + :param path: Templates are loaded from rhodecode.lib.dbmigrate.migrate package if `path` is not provided. """ pkg = 'migrate.versioning.templates' diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py b/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py @@ -11,9 +11,9 @@ from sqlalchemy import create_engine from sqlalchemy.engine import Engine from sqlalchemy.pool import StaticPool -from migrate import exceptions -from migrate.versioning.util.keyedinstance import KeyedInstance -from migrate.versioning.util.importpath import import_path +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning.util.keyedinstance import KeyedInstance +from rhodecode.lib.dbmigrate.migrate.versioning.util.importpath import import_path log = logging.getLogger(__name__) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/version.py b/rhodecode/lib/dbmigrate/migrate/versioning/version.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/version.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/version.py @@ -6,8 +6,8 @@ import re import shutil import logging -from migrate import exceptions -from migrate.versioning import pathed, script +from rhodecode.lib.dbmigrate.migrate import exceptions +from rhodecode.lib.dbmigrate.migrate.versioning import pathed, script log = logging.getLogger(__name__)