[Trunk | Admin Tools]:
1. update_db.js: Added method to add Piwik ids for each community (check ids before running it). 2. migrateCommunityIn_db.js: Added method to migrate curators (there was an error with null fields - UI needs them empty strings).
This commit is contained in:
parent
8c3db8e451
commit
f4960df528
|
@ -195,29 +195,84 @@ function migrate_portal(portalPid, beta_db_name, prod_db_name) {
|
|||
|
||||
}
|
||||
|
||||
migrate_portal("aginfra", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("rural-digital-europe", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("clarin", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("enermaps", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("ifremer", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("instruct", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("risis", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("rda", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("science-innovation-policy", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("sobigdata", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("sdsn-gr", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("elixir-gr", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("beopen", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("euromarine", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("oa-pg", 'openaireconnect_new', 'openaireconnect');
|
||||
function migrateCurators(beta_db_name, prod_db_name) {
|
||||
beta_db = db.getSiblingDB(beta_db_name);
|
||||
// beta_db.auth("your_username", "your_password");
|
||||
|
||||
prod_db = db.getSiblingDB(prod_db_name);
|
||||
// prod_db.auth("your_username", "your_password");
|
||||
|
||||
migrate_portal("covid-19", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("dariah", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("dh-ch", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("egi", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("mes", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("epos", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("fam", 'openaireconnect_new', 'openaireconnect');
|
||||
migrate_portal("ni", 'openaireconnect_new', 'openaireconnect');
|
||||
print("migrateCurators: both dbs are here");
|
||||
|
||||
// migrate curators of portal
|
||||
var beta_curators = beta_db.curator.find().forEach(function(beta_curator) {
|
||||
if (beta_curator) {
|
||||
prod_db.curator.remove({"email": beta_curator.email});
|
||||
curator = {};
|
||||
curator['_id'] = beta_curator._id; // this is aaiId
|
||||
|
||||
if(beta_curator.email) {
|
||||
curator['email'] = beta_curator.email;
|
||||
} else {
|
||||
curator['email'] = "";
|
||||
}
|
||||
|
||||
if(beta_curator.name) {
|
||||
curator['name'] = beta_curator.name;
|
||||
} else {
|
||||
curator['name'] = "";
|
||||
}
|
||||
|
||||
if(beta_curator.affiliations) {
|
||||
curator['affiliations'] = beta_curator.affiliations;
|
||||
} else {
|
||||
curator['affiliations'] = [];
|
||||
}
|
||||
|
||||
if(beta_curator.photo) {
|
||||
curator['photo'] = beta_curator.photo;
|
||||
} else {
|
||||
curator['photo'] = "";
|
||||
}
|
||||
|
||||
if(beta_curator.bio) {
|
||||
curator['bio'] = beta_curator.bio;
|
||||
} else {
|
||||
curator['bio'] = "";
|
||||
}
|
||||
// prod_db.curator.insert({"email": beta_curator.email,"name": beta_curator.name, "affiliations": beta_curator.affiliations, "photo": beta_curator.photo, "bio": beta_curator.bio});
|
||||
prod_db.curator.insert(curator);
|
||||
|
||||
print("curator "+beta_curator.name + " is migrated");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// migrate_portal("aginfra", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("rural-digital-europe", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("clarin", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("enermaps", 'openaireconnect_new', 'openaireconnect');
|
||||
// // migrate_portal("ifremer", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("instruct", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("risis", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("rda", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("science-innovation-policy", 'openaireconnect_new', 'openaireconnect');
|
||||
// // migrate_portal("sobigdata", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("sdsn-gr", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("elixir-gr", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("beopen", 'openaireconnect_new', 'openaireconnect');
|
||||
// // migrate_portal("euromarine", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("oa-pg", 'openaireconnect_new', 'openaireconnect');
|
||||
//
|
||||
//
|
||||
// migrate_portal("covid-19", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("dariah", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("dh-ch", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("egi", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("mes", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("epos", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("fam", 'openaireconnect_new', 'openaireconnect');
|
||||
// migrate_portal("ni", 'openaireconnect_new', 'openaireconnect');
|
||||
//
|
||||
|
||||
migrateCurators("openaireconnect_new", "openaireconnect");
|
||||
|
|
29
update_db.js
29
update_db.js
|
@ -1693,6 +1693,32 @@ function addPortalPidInLayoutRecords() {
|
|||
}
|
||||
}
|
||||
|
||||
// 22-10-2020
|
||||
function addPiwik() {
|
||||
db.portal.update({"pid": "openaire"}, {$set: {piwik:"6"}});
|
||||
db.portal.update({"pid": "connect"}, {$set: {piwik:"80"}});
|
||||
db.portal.update({"pid": "dh-ch"}, {$set: {piwik:"81"}});
|
||||
db.portal.update({"pid": "ee"}, {$set: {piwik:"82"}});
|
||||
db.portal.update({"pid": "egi"}, {$set: {piwik:"83"}});
|
||||
db.portal.update({"pid": "elixir-gr"}, {$set: {piwik:"84"}});
|
||||
db.portal.update({"pid": "fam"}, {$set: {piwik:"85"}});
|
||||
db.portal.update({"pid": "instruct"}, {$set: {piwik:"86"}});
|
||||
db.portal.update({"pid": "mes"}, {$set: {piwik:"87"}});
|
||||
db.portal.update({"pid": "ni"}, {$set: {piwik:"88"}});
|
||||
db.portal.update({"pid": "oa-pg"}, {$set: {piwik:"89"}});
|
||||
db.portal.update({"pid": "rda"}, {$set: {piwik:"90"}});
|
||||
db.portal.update({"pid": "aginfra"}, {$set: {piwik:"93"}});
|
||||
db.portal.update({"pid": "clarin"}, {$set: {piwik:"100"}});
|
||||
db.portal.update({"pid": "dariah"}, {$set: {piwik:"103"}});
|
||||
db.portal.update({"pid": "epos"}, {$set: {piwik:"217"}});
|
||||
db.portal.update({"pid": "beopen"}, {$set: {piwik:"218"}});
|
||||
db.portal.update({"pid": "risis"}, {$set: {piwik:"219"}});
|
||||
db.portal.update({"pid": "science-innovation-policy"}, {$set: {piwik:"253"}});
|
||||
db.portal.update({"pid": "covid-19"}, {$set: {piwik:"267"}});
|
||||
db.portal.update({"pid": "rural-digital-europe"}, {$set: {piwik:"319"}});
|
||||
db.portal.update({"pid": "enermaps"}, {$set: {piwik:"318"}});
|
||||
}
|
||||
|
||||
use openaireconnect;
|
||||
|
||||
//updatePages();
|
||||
|
@ -1765,3 +1791,6 @@ createPagesForEachPortalType();
|
|||
createDivIdsForEachPortalType();
|
||||
renameCollectionAndFields();
|
||||
addPortalPidInLayoutRecords();
|
||||
|
||||
// 22-10-2020
|
||||
// addPiwik();
|
Loading…
Reference in New Issue