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:
parent
3fe63787fb
commit
1739a009bb
1 changed files with 3 additions and 6 deletions
|
|
@ -92,11 +92,7 @@ class MongoDbMigrationHandler(GenericMigrationHandler):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if new_state['internal']:
|
if new_state['internal']:
|
||||||
collection_name = ''
|
|
||||||
# TODO ?
|
# TODO ?
|
||||||
elif new_state['rel_field_id']:
|
|
||||||
class_name = self._class_collection_name_from_field(model, new_state)
|
|
||||||
# TODO deal this case
|
|
||||||
else:
|
else:
|
||||||
collection_name = self._class_collection_name_from_field(model, new_state)
|
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)
|
self._create_field_in_collection(collection_name, uid, field_definition)
|
||||||
|
|
||||||
def emfield_del(self, model, uid, initial_state, new_state):
|
def emfield_del(self, model, uid, initial_state, new_state):
|
||||||
# TODO
|
if uid != '_id':
|
||||||
pass
|
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):
|
def _field_definition(self, fieldtype, options):
|
||||||
basic_type = DataHandler.from_name(fieldtype).ftype
|
basic_type = DataHandler.from_name(fieldtype).ftype
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue