limscoder
limscoder

Reputation: 3167

Run db statement before south migrations when running django tests

When I run django tests I need to execute a DB statement after the test database has been created, but before my south migrations run.

The statement is the following and must be executed by a user with admin privileges (Postgres 9.1): CREATE EXTENSION pg_trgm;

Where can I hook into the DB creation logic to execute this statement? I preferably only want to execute this statement during test runs, since the database is already properly configured in production, and the production db user does not have high enough privileges to execute the statement.

Upvotes: 0

Views: 148

Answers (1)

second
second

Reputation: 28637

i guess you can always make a migration that executes your statement and make all other migrations depend on it (to make sure it runs first)

in production you can run it with --fake

Upvotes: 1

Related Questions