__init__.py
44 lines
| 1.6 KiB
| text/x-python
|
PythonLexer
r833 | # -*- coding: utf-8 -*- | |||
""" | ||||
rhodecode.lib.dbmigrate.versions.__init__ | ||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||
Package containing new versions of database models | ||||
r1203 | ||||
r833 | :created_on: Dec 11, 2010 | |||
:author: marcink | ||||
r1824 | :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> | |||
r833 | :license: GPLv3, see COPYING for more details. | |||
""" | ||||
r1206 | # 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, either version 3 of the License, or | ||||
# (at your option) any later version. | ||||
r1203 | # | |||
r833 | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
# GNU General Public License for more details. | ||||
r1203 | # | |||
r833 | # You should have received a copy of the GNU General Public License | |||
r1206 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
r3148 | from sqlalchemy import * | |||
from sqlalchemy.exc import DatabaseError | ||||
from sqlalchemy.orm import relation, backref, class_mapper, joinedload | ||||
from sqlalchemy.orm.session import Session | ||||
from sqlalchemy.ext.declarative import declarative_base | ||||
from rhodecode.lib.dbmigrate.migrate import * | ||||
from rhodecode.lib.dbmigrate.migrate.changeset import * | ||||
from rhodecode.model.meta import Base | ||||
from rhodecode.model import meta | ||||
def _reset_base(migrate_engine): | ||||
## RESET COMPLETLY THE metadata for sqlalchemy to use previous declared Base | ||||
Base = declarative_base() | ||||
Base.metadata.clear() | ||||
Base.metadata = MetaData() | ||||
Base.metadata.bind = migrate_engine | ||||
meta.Base = Base | ||||