Login

Snippets by stingydrone

Snippet List

post_migrate handler to load initial SQL after migrating with south

I found that South doesn't execute initial sql file after a migration, like what Django can do after syncdb. So here's the workaround by using post_migrate signal. Usage: Put your SQL files the same way as you would if you were to use Django to load your initial SQL file (follow Django doc). The only difference is that, the SQL filename needs to in this format: <app_label>.sql OR <app_label>.<backend>.sql This is done this way since the migration is run per app.

  • custom-sql
  • south
  • initial-data
  • post_migrate
Read More

stingydrone has posted 1 snippet.