Skip to content

Commit

Permalink
Merge pull request #303 from hipster-philology/debug-postgres-conflit
Browse files Browse the repository at this point in the history
Correction conflit debug postgresql
  • Loading branch information
Juliettejns authored Mar 5, 2024
2 parents 7db560e + edcbe3c commit 79f2577
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/db_fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import copy
import unidecode
from app.models.corpus import WordToken
from sqlalchemy.sql import text


DB_CORPORA = {
Expand Down Expand Up @@ -55,9 +56,19 @@ def add_control_lists(
:param with_allowed_morph: Add allowed Morph to db
:param partial_allowed_morph: Restrict to first few Morphs
"""

cl = copy.deepcopy(DB_CORPORA[corpus]["control_list"])
db.session.add(cl)
db.session.commit()
if db.engine.dialect.name == "postgresql":
db.session.execute(
text("""SELECT setval(
pg_get_serial_sequence('control_lists', 'id'),
coalesce(max(id)+1, 1),
false
) FROM control_lists;
""")
)
add = []

if with_allowed_lemma is True:
Expand Down

0 comments on commit 79f2577

Please sign in to comment.