mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
[Configuration][Migration] Use 'alembic' for migration of the SQLite
based configuration file from one version to another, and also allows us to have a single path of creating the table instead of creating tables using SQLAlchemy or hand rolled SQL This allows us to run the migrations directly in the code, and it will avoid the error prone version numbering. Patched by: Sarah McAlear Revisions: Joao Pedro De Almeida Pereira, George Gelashvili. Reviewed by: Ashesh Vashi, Murtuza Zabuawala
This commit is contained in:
committed by
Ashesh Vashi
parent
04ccc84bf6
commit
6283ef7f5e
28
web/pgadmin/setup/db_version.py
Normal file
28
web/pgadmin/setup/db_version.py
Normal file
@@ -0,0 +1,28 @@
|
||||
##########################################################################
|
||||
#
|
||||
# pgAdmin 4 - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2013 - 2017, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
from pgadmin.model import Version
|
||||
import config
|
||||
import sys
|
||||
|
||||
|
||||
def get_version():
|
||||
try:
|
||||
version = Version.query.filter_by(name='ConfigDB').first()
|
||||
except Exception:
|
||||
return -1
|
||||
|
||||
if int(version.value) > int(config.SETTINGS_SCHEMA_VERSION):
|
||||
print(u"""
|
||||
The database schema version is {0}, whilst the version required by the \
|
||||
software is {1}.
|
||||
Exiting...""".format(version.value, config.SETTINGS_SCHEMA_VERSION))
|
||||
sys.exit(1)
|
||||
|
||||
return version.value
|
||||
Reference in New Issue
Block a user