Commits

Maximiliano Robaina committed 3b01b56

Firebird: Implemented rename_table and delete_table methods. Set feature has_boolean to False

Comments (0)

Files changed (1)

south/db/firebird.py

     alter_string_drop_null = ''
     add_column_string = 'ALTER TABLE %s ADD %s;'
     delete_column_string = 'ALTER TABLE %s DROP %s;'
+    rename_table_sql = ''
+
+    # Features
     allows_combined_alters = False
+    has_booleans = False
 
     def _fill_constraint_cache(self, db_name, table_name):
         self._constraint_cache.setdefault(db_name, {})
             col = self.column_sql(table_name, field_name, field)
             if not col:
                 continue
-            #col = self.adj_column_sql(col)
 
             columns.append(col)
             if isinstance(field, models.AutoField):
             self.execute(autoinc_sql[0])
             self.execute(autoinc_sql[1])
 
+    def rename_table(self, old_table_name, table_name):
+        """
+        Renames table is not supported by firebird.
+        This involve recreate all related objects (store procedure, views, triggers, etc)
+        """
+        pass
+
+    @generic.invalidate_table_constraints
+    def delete_table(self, table_name, cascade=False):
+        """
+        Deletes the table 'table_name'.
+        Firebird will also delete any triggers associated with the table.
+        """
+        super(DatabaseOperations, self).delete_table(table_name, cascade=False)
+
+        # Also, drop sequence if exists
+        sql = connection.ops.drop_sequence_sql(table_name)
+        if sql:
+            try:
+                self.execute(sql)
+            except:
+                pass
 
     def column_sql(self, table_name, field_name, field, tablespace='', with_name=True, field_prepared=False):
         """
         """
 
         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
         if hasattr(field, 'south_init'):
             field.south_init()