1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2025-11-13 17:39:16 +01:00

Implemented the emfield_del method in the migration handler

This commit is contained in:
Roland Haroutiounian 2016-05-27 11:18:40 +02:00
commit 1739a009bb

View file

@ -92,11 +92,7 @@ class MongoDbMigrationHandler(GenericMigrationHandler):
return True
if new_state['internal']:
collection_name = ''
# TODO ?
elif new_state['rel_field_id']:
class_name = self._class_collection_name_from_field(model, new_state)
# TODO deal this case
else:
collection_name = self._class_collection_name_from_field(model, new_state)
@ -104,8 +100,9 @@ class MongoDbMigrationHandler(GenericMigrationHandler):
self._create_field_in_collection(collection_name, uid, field_definition)
def emfield_del(self, model, uid, initial_state, new_state):
# TODO
pass
if uid != '_id':
collection_name = self._class_collection_name_from_field(model, initial_state)
self.database[collection_name].update_many({field:{'$exists':True}}, {'$unset':{field:1}}, False)
def _field_definition(self, fieldtype, options):
basic_type = DataHandler.from_name(fieldtype).ftype