Created
September 27, 2016 09:15
-
-
Save d2rk/1fc4c455ae40317553882c37cde337cf to your computer and use it in GitHub Desktop.
Flush Django database (postgresql)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import connection | |
from django.core.management import call_command | |
cursor = connection.cursor() | |
cursor.execute("DROP SCHEMA public CASCADE;") | |
cursor.execute("CREATE SCHEMA public;") | |
call_command('migrate') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment