Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #34 #35

Merged
merged 2 commits into from Mar 7, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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