Run SQL post DB creation but pre migrations with pytest

445 views Asked by At

I have a django project that some of its models use a special index.
For this reason i create a extension in my db pre-migrations. When i run the tests, pytest creates a test db and runs the migrations but no extension is created. I cannot create the extension inside the migrations. Is there any way to insert a "RunSQL" command on the test db after db creation but before the migrations run?
Tech stuff:

  • Django 1.9.5
  • pytest
  • postgres 9.5
0

There are 0 answers