Changeset - e36bc85e3ecb
[Not reviewed]
default
0 1 1
Søren Løvborg - 9 years ago 2016-05-24 12:02:23
sorenl@unity3d.com
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.)
2 files changed with 37 insertions and 11 deletions:
0 comments (0 inline, 0 general)
kallithea/alembic/versions/9358dc3d6828_drop_sqlalchemy_migrate_support.py
Show inline comments
 
new file 100644
 
# 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')
kallithea/model/db.py
Show inline comments
 
@@ -2559,14 +2559,3 @@ class Gist(Base, BaseModel):
 
        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)
0 comments (0 inline, 0 general)