I needed to write my own Trigger to be able to update some search vectors in my Postgres database and alembic/ Sqlalchemy weren't able to autogenerate these.
For that I added my custom SQL into a migrations file. Using my dev machine everything works fine. But I noticed that the trigger is created when running my tests.
For testing I use purest and tox. My conftest.py creates the database like so:
@pytest.fixture
def db(app):
_db.app = app
with app.app_context():
_db.create_all()
Role.insert_roles() # insert roles
yield _db # teardown
_db.session.close()
_db.drop_all()
But this script only creates the raw tables. What should I change, so that my custom SQL will be executed every time a new database is created?
Thank you