Sfoglia il codice sorgente

Bugfix on multivalue field deletion

Yann Weber 8 anni fa
parent
commit
e90ea6e39d
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2
    1
      DataSource/MySQL/migrationhandler.py

+ 2
- 1
DataSource/MySQL/migrationhandler.py Vedi File

@@ -9,6 +9,7 @@ import EditorialModel
9 9
 import EditorialModel.classtypes
10 10
 import EditorialModel.fieldtypes
11 11
 import EditorialModel.fieldtypes.generic
12
+from EditorialModel.fieldtypes.generic import MultiValueFieldType
12 13
 
13 14
 from DataSource.MySQL import fieldtypes as fieldtypes_utils
14 15
 from DataSource.MySQL import utils
@@ -468,7 +469,7 @@ ADD COLUMN {col_name} {col_type} {col_specs};"""
468 469
         tname = utils.object_table_name(emfield.em_class.name)
469 470
         tname = utils.multivalue_table_name(tname, ftype.keyname)
470 471
         self._del_column(tname, emfield.name)
471
-        if len([ f for f in emfield.em_class.fields()]) == 0:
472
+        if len([ f for f in emfield.em_class.fields() if isinstance(f.fieldtype_instance(), MultiValueFieldType)]) == 0:
472 473
             try:
473 474
                 self._query("DROP TABLE %s;" % utils.escape_idname(tname))
474 475
             except self._dbmodule.err.InternalError as expt:

Loading…
Annulla
Salva