Skip to content

Commit

Permalink
Merge pull request #35 from jpic/master
Browse files Browse the repository at this point in the history
Fix #34
  • Loading branch information
paltman committed Mar 7, 2012
2 parents 0a0d544 + 0b331f2 commit 7c5fdfd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions nashvegas/management/commands/comparedb.py
Expand Up @@ -26,13 +26,13 @@ class Command(BaseCommand):
def setup_database(self):
command = "createdb %s" % self.name
if NASHVEGAS and "createdb" in settings.NASHVEGAS:
command = settings.NASHVEGAS["createdb"]
command = "%s %s" % (settings.NASHVEGAS["createdb"], self.name)
Popen(command.split()).wait()

def teardown_database(self):
command = "dropdb %s" % self.name
if NASHVEGAS and "dropdb" in settings.NASHVEGAS:
command = settings.NASHVEGAS["dropdb"]
command = "%s %s" % (settings.NASHVEGAS["dropdb"], self.name)
Popen(command.split()).wait()

def handle(self, *args, **options):
Expand All @@ -50,9 +50,11 @@ def handle(self, *args, **options):

command = "pg_dump -s %s" % connections[self.db].settings_dict["NAME"]
if NASHVEGAS and "pg_dump" in settings.NASHVEGAS:
command = settings.NASHVEGAS["pg_dump"]
command = "%s -s %s" % (settings.NASHVEGAS["pg_dump"],
connections[self.db].settings_dict["NAME"])

print "Getting schema for current database..."
print command
current_sql = Popen(command.split(), stdout=PIPE).stdout.readlines()

print "Getting schema for fresh database..."
Expand All @@ -61,7 +63,9 @@ def handle(self, *args, **options):
connections[self.db].close()
connections[self.db].settings_dict["NAME"] = self.name
call_command("syncdb", interactive=False, verbosity=0)
new_sql = Popen(command.split(), stdout=PIPE).stdout.readlines()
print command
new_sql = Popen(command.split() + ["-s", self.name],
stdout=PIPE).stdout.readlines()
connections[self.db].close()
connections[self.db].settings_dict["NAME"] = orig
self.teardown_database()
Expand Down

0 comments on commit 7c5fdfd

Please sign in to comment.