Mercurial > kallithea
changeset 6022:e36bc85e3ecb
db: remove SQLAlchemy Migrate database table
Use Alembic to migrate database away from SQLAlchemy Migrate. This
eliminates the last vestiges of SQLAlchemy Migrate. Since we drop
the Migrate table (and its contents), it is not possible to revert
this database change; however, downgrading to this Alembic schema
revision (9358dc3d6828) will in practice be enough to ensure
compatibility with all previous Kallithea versions.
(As always, the Alembic migration script is committed in the same
revision as the database schema changes.)
author | Søren Løvborg <sorenl@unity3d.com> |
---|---|
date | Tue, 24 May 2016 12:02:23 +0200 |
parents | c095a2f38add |
children | 9fd64dd2617d |
files | kallithea/alembic/versions/9358dc3d6828_drop_sqlalchemy_migrate_support.py kallithea/model/db.py |
diffstat | 2 files changed, 37 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kallithea/alembic/versions/9358dc3d6828_drop_sqlalchemy_migrate_support.py Tue May 24 12:02:23 2016 +0200 @@ -0,0 +1,37 @@ +# 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. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Drop SQLAlchemy Migrate support + +Revision ID: 9358dc3d6828 +Revises: +Create Date: 2016-03-01 15:21:30.896585 + +""" + +# The following opaque hexadecimal identifiers ("revisions") are used +# by Alembic to track this migration script and its relations to others. +revision = '9358dc3d6828' +down_revision = None +branch_labels = None +depends_on = None + +from alembic import op + + +def upgrade(): + op.drop_table('db_migrate_version') + + +def downgrade(): + raise NotImplementedError('cannot revert to SQLAlchemy Migrate')
--- a/kallithea/model/db.py Tue Jul 05 13:40:19 2016 +0200 +++ b/kallithea/model/db.py Tue May 24 12:02:23 2016 +0200 @@ -2559,14 +2559,3 @@ base_path = self.base_path() return get_repo(os.path.join(*map(safe_str, [base_path, self.gist_access_id]))) - - -class DbMigrateVersion(Base, BaseModel): - __tablename__ = 'db_migrate_version' - __table_args__ = ( - _table_args_default_dict, - ) - - repository_id = Column(String(250), primary_key=True) - repository_path = Column(Text, nullable=False) - version = Column(Integer, nullable=False)