Waziup / Platform-deploy

1 stars 2 forks source link

V2 mongoDB migration #2

Open cdupont opened 5 years ago

cdupont commented 5 years ago

Data from MongoDB and MySQL need to be migrated to new format. Old format:

New format:

cdupont commented 5 years ago

Actions:

cdupont commented 5 years ago

Used this script:

use waziup_history;
db.getCollectionNames().forEach(function(collname) {
  db.getCollection(collname).copyTo(db.getSiblingDB('waziup')['waziup_history'])
  print(collname + " done");
});

use waziup;
db.waziup_history.update({}, {$rename:{"entityID":"device_id", "attributeID":"sensor_id"}, $unset: {"entityType":""}}, false, true);
cdupont commented 5 years ago

Problem now is to add the keycloak Id for existing sensors. Or should they be considered public? Script need to: