Ticket #937 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

(patch) explicitly log when --db-dry-run won't work

Reported by: david.lowe@… Owned by: andrew
Priority: trivial Milestone:
Component: migrations Version: 0.7.3
Keywords: Cc:

Description

I just spent 20 minutes digging around the South codebase trying to figure out why the DDL output from --db-dry-run --verbosity 2 was different from the output of an actual run with the same verbosity.

I understand now. But I'd suggest emitting a quick note to explain to future spelunkers:

--- generic.py.original	2011-10-25 00:29:56.000000000 +0000
+++ generic.py	2011-10-25 00:31:01.000000000 +0000
@@ -321,6 +321,8 @@
         """
         
         if self.dry_run:
+            if self.debug:
+                print '   - no dry run output for alter_column() due to dynamic DDL, sorry'
             return
 
         # hook for the field to do any resolution prior to it's attributes being queried
@@ -472,6 +474,8 @@
 
         # Dry runs mean we can't do anything.
         if self.dry_run:
+            if self.debug:
+                print '   - no dry run output for delete_unique_column() due to dynamic DDL, sorry'
             return
 
         constraints = list(self._constraints_affecting_columns(table_name, columns))
@@ -611,6 +615,8 @@
     def delete_foreign_key(self, table_name, column):
         "Drop a foreign key constraint"
         if self.dry_run:
+            if self.debug:
+                print '   - no dry run output for delete_foreign_key() due to dynamic DDL, sorry'
             return # We can't look at the DB to get the constraints
         constraints = list(self._constraints_affecting_columns(table_name, [column], "FOREIGN KEY"))
         if not constraints:
@@ -714,6 +720,8 @@
         """
         # Dry runs mean we can't do anything.
         if self.dry_run:
+            if self.debug:
+                print '   - no dry run output for delete_primary_key() due to dynamic DDL, sorry'
             return
         
         constraints = list(self._constraints_affecting_columns(table_name, None, type="PRIMARY KEY"))

Change History

comment:1 Changed 3 years ago by andrew

Fixed in [2e7ec634aa38].

comment:2 Changed 3 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.