mirror of
https://github.com/yweber/lodel2.git
synced 2025-11-13 09:29:16 +01:00
Implemented the emfield_del method in the migration handler
This commit is contained in:
parent
3fe63787fb
commit
1739a009bb
1 changed files with 3 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue