Browse Source

Bugfix on multivalue field deletion

Yann Weber 8 years ago
parent
commit
e90ea6e39d
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      DataSource/MySQL/migrationhandler.py

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

9
 import EditorialModel.classtypes
9
 import EditorialModel.classtypes
10
 import EditorialModel.fieldtypes
10
 import EditorialModel.fieldtypes
11
 import EditorialModel.fieldtypes.generic
11
 import EditorialModel.fieldtypes.generic
12
+from EditorialModel.fieldtypes.generic import MultiValueFieldType
12
 
13
 
13
 from DataSource.MySQL import fieldtypes as fieldtypes_utils
14
 from DataSource.MySQL import fieldtypes as fieldtypes_utils
14
 from DataSource.MySQL import utils
15
 from DataSource.MySQL import utils
468
         tname = utils.object_table_name(emfield.em_class.name)
469
         tname = utils.object_table_name(emfield.em_class.name)
469
         tname = utils.multivalue_table_name(tname, ftype.keyname)
470
         tname = utils.multivalue_table_name(tname, ftype.keyname)
470
         self._del_column(tname, emfield.name)
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
             try:
473
             try:
473
                 self._query("DROP TABLE %s;" % utils.escape_idname(tname))
474
                 self._query("DROP TABLE %s;" % utils.escape_idname(tname))
474
             except self._dbmodule.err.InternalError as expt:
475
             except self._dbmodule.err.InternalError as expt:

Loading…
Cancel
Save