Skip to content

Commit

Permalink
[#61592] server: db.py: Changed stamping to apply only to sqlite dbs
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bylicki <[email protected]>
  • Loading branch information
jbylicki committed Jul 19, 2024
1 parent febcc38 commit 1c8194d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/src/database/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ def _fk_pragma_on_connect(dbapi_con, con_record):
event.listen(db, "connect", _fk_pragma_on_connect)

if os.path.isfile('alembic.ini'):
# If the database exists but is not managed by alembic,
# we assume it is the initial version and stamp it as such.
# If the database exists, is not empty,
# and is not managed by alembic, we assume it is
# the initial version and stamp it as such.
if (
database_exists(connstring) and
len(inspect(db).get_table_names()) > 0 and
not inspect(db).has_table("alembic_version")
):
alembic_args = [
Expand Down

0 comments on commit 1c8194d

Please sign in to comment.