Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

my proposal to solve the bug #22 #23

Closed
wants to merge 1 commit into from

3 participants

@marcinn

No description provided.

@brosner
Collaborator

The previous behavior was not a bug and very intentional. This changes the old behavior in a backwards incompatible way. While I understand why this is done, it needs much more thought. I'll need to think about this some more.

@paltman
Owner

@marcinn after careful consideration and upon seeing a different implementation we have decided to bring back transactional support by merging in #44, thank you for bringing this issue back up and even though your PR was not merged the contribution was/is appreciated.

@paltman paltman closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 26, 2011
  1. @marcinn
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 23 deletions.
  1. +26 −23 nashvegas/management/commands/upgradedb.py
View
49 nashvegas/management/commands/upgradedb.py
@@ -165,8 +165,9 @@ def execute_migrations(self, show_traceback=False):
created_models = set()
- try:
- for migration in migrations:
+ for migration in migrations:
+ iteration_models = set()
+ try:
migration_path = os.path.join(self.path, migration)
fp = open(migration_path, "rb")
lines = fp.readlines()
@@ -194,7 +195,7 @@ def execute_migrations(self, show_traceback=False):
for l in lines:
if l.startswith("### New Model: "):
- created_models.add(
+ iteration_models.add(
get_model(
*l.replace("### New Model: ", "").strip().split(".")
)
@@ -221,26 +222,28 @@ def execute_migrations(self, show_traceback=False):
content=content,
scm_version=self._get_rev(migration_path)
)
- sys.stdout.write("Emitting post sync signal.\n")
- emit_post_sync_signal(
- created_models,
- self.verbosity,
- self.interactive,
- self.db
- )
- sys.stdout.write("Running loaddata for initial_data fixtures.\n")
- call_command(
- "loaddata",
- "initial_data",
- verbosity=self.verbosity,
- database=self.db
- )
- except Exception:
- transaction.rollback(using=self.db)
- sys.stdout.write("Rolled back all migrations.\n")
- raise
- else:
- transaction.commit(using=self.db)
+ except Exception:
+ transaction.rollback(using=self.db)
+ sys.stdout.write("Rolled back all migrations.\n")
+ raise
+ else:
+ created_models = created_models.union(iteration_models)
+ transaction.commit(using=self.db)
+
+ sys.stdout.write("Emitting post sync signal.\n")
+ emit_post_sync_signal(
+ created_models,
+ self.verbosity,
+ self.interactive,
+ self.db
+ )
+ sys.stdout.write("Running loaddata for initial_data fixtures.\n")
+ call_command(
+ "loaddata",
+ "initial_data",
+ verbosity=self.verbosity,
+ database=self.db
+ )
def seed_migrations(self, stop_at=None):
# @@@ the command-line interface needs to be re-thinked
Something went wrong with that request. Please try again.