Skip to content

Commit

Permalink
ajout autoincrementation id pour control lists dans add_controls_list…
Browse files Browse the repository at this point in the history
…s de db fixtures - corrections bug test-dashboard et manage-corpus-user
  • Loading branch information
Juliettejns committed Mar 5, 2024
1 parent e5fcf62 commit edcbe3c
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 edcbe3c

Please sign in to comment.