mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-26 02:30:21 -06:00
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
##########################################################################
|
|
#
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
#
|
|
# Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
|
# This software is released under the PostgreSQL Licence
|
|
#
|
|
##########################################################################
|
|
|
|
from pgadmin.model import Version, db
|
|
from sqlalchemy.orm.session import Session
|
|
|
|
|
|
def get_version():
|
|
try:
|
|
version = Version.query.filter_by(name='ConfigDB').first()
|
|
except Exception:
|
|
db.session.rollback()
|
|
return -1
|
|
|
|
if version:
|
|
return version.value
|
|
else:
|
|
return -1
|
|
|
|
|
|
def get_version_for_migration(op):
|
|
try:
|
|
session = Session(bind=op.get_bind())
|
|
version = session.query(Version).filter_by(name='ConfigDB').first()
|
|
except Exception:
|
|
return -1
|
|
|
|
if version:
|
|
return version.value
|
|
else:
|
|
return -1
|
|
|
|
|
|
def set_version(new_version):
|
|
version = Version.query.filter_by(name='ConfigDB').first()
|
|
version.value = new_version
|