I need to run this SQL after the test database is created but before creating any tables:
`CREATE EXTENSION pg_trgm;
CREATE EXTENSION btree_gin;
I know that I can somehow use django_db_setup fixture to do this but I can't figure out how.
I use
addopts = --no-migrations
in my pytest.ini file so this can't be done using migrations
It should be something like this:
@pytest.fixture(scope='session')
def django_db_setup():
# Some code to create database
with connection.cursor() as cursor:
cursor.execute('CREATE EXTENSION IF NOT EXISTS pg_trgm;')
cursor.execute('CREATE EXTENSION IF NOT EXISTS btree_gin;')
# Code for creating tables