mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Fix session.execute in integration test utils
This commit is contained in:
parent
fe64f15949
commit
adbbaf93c6
@ -1,15 +1,18 @@
|
||||
import pytest, json
|
||||
from sqlalchemy import text
|
||||
|
||||
from app import app
|
||||
from app.models import db, User
|
||||
from app.default_data import populate
|
||||
|
||||
|
||||
def clear_data(session):
|
||||
meta = db.metadata
|
||||
for table in reversed(meta.sorted_tables):
|
||||
session.execute(f'ALTER TABLE "{table.name}" DISABLE TRIGGER ALL;')
|
||||
session.execute(text(f'ALTER TABLE "{table.name}" DISABLE TRIGGER ALL;'))
|
||||
session.execute(table.delete())
|
||||
session.execute(f'ALTER TABLE "{table.name}" ENABLE TRIGGER ALL;')
|
||||
#session.execute(table.delete())
|
||||
session.execute(text(f'ALTER TABLE "{table.name}" ENABLE TRIGGER ALL;'))
|
||||
|
||||
|
||||
def recreate_db():
|
||||
clear_data(db.session)
|
||||
|
Loading…
Reference in New Issue
Block a user