Skip to content

Commit

Permalink
do not reference a modified row before it's modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch Matuson committed Feb 11, 2012
1 parent 022a4a5 commit 3f8e1f0
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions schemasync/syncdb.py
Expand Up @@ -66,16 +66,6 @@ def sync_table(from_table, to_table, options):
Yields: Yields:
A tuple (patch, revert) containing the next SQL statements A tuple (patch, revert) containing the next SQL statements
""" """
for p, r in sync_created_columns(from_table.columns,
to_table.columns,
sync_comments=options['sync_comments']):
yield (p, r)

for p, r in sync_dropped_columns(from_table.columns,
to_table.columns,
sync_comments=options['sync_comments']):
yield (p, r)

if from_table and to_table: if from_table and to_table:
for p, r in sync_modified_columns(from_table.columns, for p, r in sync_modified_columns(from_table.columns,
to_table.columns, to_table.columns,
Expand Down Expand Up @@ -115,6 +105,15 @@ def sync_table(from_table, to_table, options):
if p: if p:
yield (p, r) yield (p, r)


for p, r in sync_created_columns(from_table.columns,
to_table.columns,
sync_comments=options['sync_comments']):
yield (p, r)

for p, r in sync_dropped_columns(from_table.columns,
to_table.columns,
sync_comments=options['sync_comments']):
yield (p, r)


def sync_database_options(from_db, to_db): def sync_database_options(from_db, to_db):
"""Generate the SQL statements needed to modify the Database options """Generate the SQL statements needed to modify the Database options
Expand Down

2 comments on commit 3f8e1f0

@SkaveRat
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit works as expected. MODIFY statements are now in front of add/drop statements.

@mmatuson
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for helping test this fix.

Please sign in to comment.