Revision 59934
Added by Argiro Kokogiannaki over 3 years ago
modules/uoa-claims/trunk/src/test/java/eu/dnetlib/data/claims/CopyFromBetaTest.java | ||
---|---|---|
1 |
package eu.dnetlib.data.claims; |
|
2 |
|
|
3 |
import eu.dnetlib.data.claims.entity.Claim; |
|
4 |
import eu.dnetlib.data.claims.entity.Result; |
|
5 |
import eu.dnetlib.data.claims.handler.*; |
|
6 |
import eu.dnetlib.data.claims.sql.SQLStoreException; |
|
7 |
import eu.dnetlib.data.claims.utils.*; |
|
8 |
import org.apache.log4j.BasicConfigurator; |
|
9 |
import org.apache.log4j.Level; |
|
10 |
import org.apache.log4j.Logger; |
|
11 |
import org.junit.Before; |
|
12 |
import org.junit.Test; |
|
13 |
import org.junit.runner.RunWith; |
|
14 |
import org.springframework.context.ApplicationContext; |
|
15 |
import org.springframework.context.annotation.PropertySource; |
|
16 |
import org.springframework.context.support.ClassPathXmlApplicationContext; |
|
17 |
import org.springframework.test.context.ContextConfiguration; |
|
18 |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|
19 |
|
|
20 |
import java.io.BufferedWriter; |
|
21 |
import java.io.FileWriter; |
|
22 |
import java.io.PrintWriter; |
|
23 |
import java.util.ArrayList; |
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import static junit.framework.Assert.assertNotNull; |
|
27 |
|
|
28 |
@RunWith(SpringJUnit4ClassRunner.class) |
|
29 |
@ContextConfiguration(locations = {"springContext-claims.xml"}) |
|
30 |
@PropertySource("springContext-claims.properties") |
|
31 |
public class CopyFromBetaTest { |
|
32 |
private Logger log = Logger.getLogger(this.getClass()); |
|
33 |
ClaimHandler claimHandler = null; |
|
34 |
FetchClaimHandler fetchClaimHandler = null; |
|
35 |
private PrintWriter out; |
|
36 |
|
|
37 |
|
|
38 |
@Before |
|
39 |
public void init() throws Exception { |
|
40 |
BasicConfigurator.configure(); |
|
41 |
ApplicationContext context = new ClassPathXmlApplicationContext("eu/dnetlib/data/claims/springContext-claims.xml"); |
|
42 |
claimHandler = context.getBean(ClaimHandler.class); |
|
43 |
fetchClaimHandler = context.getBean(FetchClaimHandler.class); |
|
44 |
|
|
45 |
} |
|
46 |
@Test |
|
47 |
public void CopyFromBetaToProduction(){ |
|
48 |
log.setLevel(Level.ERROR); |
|
49 |
QueryGenerator q = new QueryGenerator(); |
|
50 |
System.out.println(q.generateCreateClaimTablesQuery()); |
|
51 |
try { |
|
52 |
|
|
53 |
|
|
54 |
fetchClaimHandler.getQueryGenerator().setMigrationTable("claims_beta"); |
|
55 |
ArrayList<String> communities = new ArrayList<>(); |
|
56 |
communities.add("ee"); |
|
57 |
// communities.add("mes"); |
|
58 |
// communities.add("fam"); |
|
59 |
// communities.add("ni"); |
|
60 |
// communities.add("dh-ch"); |
|
61 |
// communities.add("covid-19"); |
|
62 |
String startDate = "2018-03-01"; |
|
63 |
String endDate = "2020-11-22"; |
|
64 |
|
|
65 |
fetchClaimHandler.getSqlDAO().getSqlStore().setDbUrl("jdbc:postgresql://scoobydoo.di.uoa.gr:5432/claims_beta"); |
|
66 |
List<Claim> claims = fetchClaimHandler.fetchClaimsByDateForDashboards(startDate,endDate, null,null,true, communities); |
|
67 |
System.out.println("Beta claims: "); |
|
68 |
System.out.println(claims.size()); |
|
69 |
|
|
70 |
claimHandler.getSqlDAO().getSqlStore().setDbUrl("jdbc:postgresql://scoobydoo.di.uoa.gr:5432/movedb"); |
|
71 |
|
|
72 |
out = new PrintWriter(new BufferedWriter(new FileWriter("/home/argirok/claims_migratedFromBeta_record_paths.txt", true))); |
|
73 |
|
|
74 |
for (Claim claim : claims) { |
|
75 |
|
|
76 |
if(out!=null) { |
|
77 |
if(!claim.getTargetType().equals("project") && !claim.getTargetType().equals("context")){ |
|
78 |
System.out.println(((Result)claim.getTarget()).getRecordPath()); |
|
79 |
out.println("cp beta_records/" + ((Result)claim.getTarget()).getRecordPath() + " records/"+((Result)claim.getTarget()).getRecordPath()); |
|
80 |
} |
|
81 |
if(!claim.getSourceType().equals("project") && !claim.getSourceType().equals("context")){ |
|
82 |
System.out.println(((Result)claim.getSource()).getRecordPath()); |
|
83 |
out.println("cp beta_records/" + ((Result)claim.getSource()).getRecordPath() + " records/"+((Result)claim.getSource()).getRecordPath()); |
|
84 |
} |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
System.out.println(claim.getId()); |
|
89 |
// claimHandler.saveClaim(claim); |
|
90 |
} |
|
91 |
if(out!=null) { |
|
92 |
out.close(); |
|
93 |
} |
|
94 |
List<Claim> claimsmoveDB = fetchClaimHandler.fetchClaimsByDate(startDate,endDate, null, null, true); |
|
95 |
System.out.println("Movedb claims:"); |
|
96 |
System.out.println(claimsmoveDB.size()); |
|
97 |
|
|
98 |
|
|
99 |
} catch (Exception | SQLStoreException e) { |
|
100 |
log.error("Error in migration",e); |
|
101 |
|
|
102 |
} |
|
103 |
|
|
104 |
} |
|
105 |
|
|
106 |
} |
modules/uoa-claims/trunk/src/main/java/eu/dnetlib/data/claims/migration/CopyFromBetaToProduction.java | ||
---|---|---|
1 |
package eu.dnetlib.data.claims.migration; |
|
2 |
|
|
3 |
import eu.dnetlib.data.claims.entity.Claim; |
|
4 |
import eu.dnetlib.data.claims.handler.ClaimHandler; |
|
5 |
import eu.dnetlib.data.claims.handler.FetchClaimHandler; |
|
6 |
import eu.dnetlib.data.claims.sql.SQLStoreException; |
|
7 |
import eu.dnetlib.data.claims.utils.QueryGenerator; |
|
8 |
import org.apache.log4j.BasicConfigurator; |
|
9 |
import org.apache.log4j.Level; |
|
10 |
import org.apache.log4j.Logger; |
|
11 |
import org.springframework.context.ApplicationContext; |
|
12 |
import org.springframework.context.support.ClassPathXmlApplicationContext; |
|
13 |
|
|
14 |
import java.io.IOException; |
|
15 |
import java.util.ArrayList; |
|
16 |
import java.util.List; |
|
17 |
|
|
18 |
|
|
19 |
public class CopyFromBetaToProduction { |
|
20 |
private static final Logger logger = Logger.getLogger(CopyFromBetaToProduction.class); |
|
21 |
ClaimHandler claimHandler = null; |
|
22 |
FetchClaimHandler fetchClaimHandler = null; |
|
23 |
|
|
24 |
public CopyFromBetaToProduction() { |
|
25 |
ApplicationContext context = new ClassPathXmlApplicationContext("eu/dnetlib/data/claims/springContext-claims.xml"); |
|
26 |
claimHandler = context.getBean(ClaimHandler.class); |
|
27 |
fetchClaimHandler = context.getBean(FetchClaimHandler.class); |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
private void saveClaims(List<Claim> claims) throws Exception, SQLStoreException { |
|
32 |
for(Claim claim : claims){ |
|
33 |
/* if(claim.getTargetType().equals(ClaimUtils.DATASET)||claim.getTargetType().equals(ClaimUtils.PUBLICATION)){ |
|
34 |
String path = resultHandler.exportMetadataFileForResult((Result)claim.getTarget()); |
|
35 |
((Result) claim.getTarget()).setRecordPath(path); |
|
36 |
} |
|
37 |
if(claim.getSourceType().equals(ClaimUtils.DATASET)||claim.getSourceType().equals(ClaimUtils.PUBLICATION)){ |
|
38 |
String path = resultHandler.exportMetadataFileForResult((Result)claim.getSource()); |
|
39 |
((Result) claim.getSource()).setRecordPath(path); |
|
40 |
}*/ |
|
41 |
claim = claimHandler.exportMedatataForClaim(claim); |
|
42 |
claimHandler.saveClaim(claim); |
|
43 |
} |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
public static void main(String[] args) throws IOException { |
|
50 |
BasicConfigurator.configure(); |
|
51 |
logger.setLevel(Level.DEBUG); |
|
52 |
QueryGenerator q = new QueryGenerator(); |
|
53 |
System.out.println(q.generateCreateClaimTablesQuery()); |
|
54 |
CopyFromBetaToProduction migration = new CopyFromBetaToProduction(); |
|
55 |
try { |
|
56 |
|
|
57 |
|
|
58 |
// migration.fetchClaimHandler.getQueryGenerator().setMigrationTable("claims_beta"); |
|
59 |
ArrayList<String> communities = new ArrayList<>(); |
|
60 |
communities.add("ee"); |
|
61 |
communities.add("mes"); |
|
62 |
communities.add("fam"); |
|
63 |
communities.add("ni"); |
|
64 |
communities.add("dh-ch"); |
|
65 |
String startDate = "2018-03-01"; |
|
66 |
String endDate = "2019-12-31"; |
|
67 |
|
|
68 |
migration.fetchClaimHandler.getSqlDAO().getSqlStore().setDbUrl("jdbc:postgresql://scoobydoo.di.uoa.gr:5432/claims_beta"); |
|
69 |
List<Claim> claims = migration.fetchClaimHandler.fetchClaimsByDateForDashboards(startDate,endDate, null,null,true, communities); |
|
70 |
System.out.println("Beta claims: "); |
|
71 |
System.out.println(claims.size()); |
|
72 |
|
|
73 |
/*migration.claimHandler.getSqlDAO().getSqlStore().setDbUrl("jdbc:postgresql://scoobydoo.di.uoa.gr:5432/movedb"); |
|
74 |
|
|
75 |
for (Claim claim : claims) { |
|
76 |
// System.out.println(claim); |
|
77 |
migration.claimHandler.saveClaim(claim); |
|
78 |
} |
|
79 |
List<Claim> claimsmoveDB = migration.fetchClaimHandler.fetchClaimsByDate(startDate,endDate, null, null, true); |
|
80 |
System.out.println("Movedb claims:"); |
|
81 |
System.out.println(claimsmoveDB.size());*/ |
|
82 |
|
|
83 |
|
|
84 |
} catch (Exception | SQLStoreException e) { |
|
85 |
logger.error("Error in migration",e); |
|
86 |
|
|
87 |
} |
|
88 |
|
|
89 |
} |
|
90 |
|
|
91 |
} |
modules/uoa-claims/trunk/src/main/java/eu/dnetlib/data/claims/migration/stepsTomigrateFromBetaToProduction | ||
---|---|---|
1 |
1.[beta] work on beta |
|
2 |
1.1 connect to beta |
|
3 |
ssh argiro.kokogiannaki@beta.services.openaire.eu |
|
4 |
1.2 Export tables from beta |
|
5 |
pg_dump -U dnet -h localhost dnet_openaireplus -t context -t project -t result -t has_source_context -t has_source_project -t has_source_result -t has_target_project -t has_target_result -t claim -t notification --password >claims20190720.sql |
|
6 |
|
|
7 |
pg_dump --column-inserts --data-only -U dnet -h localhost dnet_openaireplus -t notification --password >notifications20190801.sql |
|
8 |
1.3 Get records |
|
9 |
|
|
10 |
ll /srv/claims/records/ |
|
11 |
tar -czvf records.beta.20190801.tar.gz /srv/claims/records/ |
|
12 |
scp records.beta.20190801.tar.gz argirok@scoobydoo.di.uoa.gr:~/ |
|
13 |
|
|
14 |
2. dump in local db |
|
15 |
|
|
16 |
2.1 create local db |
|
17 |
create database claims_beta |
|
18 |
|
|
19 |
|
|
20 |
2.2 insert records |
|
21 |
psql -h localhost -U postgres claims_beta --password < claims20190720.sql |
|
22 |
|
|
23 |
|
|
24 |
3. prepare db to put new records |
|
25 |
|
|
26 |
3.1 create db |
|
27 |
create database claims_prod |
|
28 |
|
|
29 |
3.2 create claim tables for local db |
|
30 |
|
|
31 |
3.3 set sequence numbers not to override anything in production: |
|
32 |
ALTER SEQUENCE result_id_seq RESTART WITH 10000; ALTER SEQUENCE claim_id_seq RESTART WITH 12000; |
|
33 |
|
|
34 |
|
|
35 |
4. Run Java migration |
|
36 |
|
|
37 |
5. export prod records |
|
38 |
|
|
39 |
pg_dump --column-inserts --data-only -U postgres -h localhost movedb -t context -t project -t result -t has_source_context -t has_source_project -t has_source_result -t has_target_project -t has_target_result -t claim -t --password >claims_new_20190720.sql |
|
40 |
|
|
41 |
6. [prod] set sequence numbers after the ids of the new claims |
|
42 |
psql -h postgresql.services.openaire.eu dnet_openaireplus -U dnet |
|
43 |
ALTER SEQUENCE result_id_seq RESTART WITH 11000; ALTER SEQUENCE claim_id_seq RESTART WITH 12800; |
|
44 |
|
|
45 |
7.[prod] |
|
46 |
|
|
47 |
7.1 insert records in production db |
|
48 |
psql -U dnet -h postgresql.services.openaire.eu dnet_openaireplus --password < claims_new_20190720.sql |
|
49 |
|
|
50 |
8.[prod] notifications in production |
|
51 |
|
|
52 |
8.1 insert notifications records in production db |
|
53 |
psql -U dnet -h postgresql.services.openaire.eu dnet_openaireplus --password < notifications20190801.sql |
|
54 |
|
|
55 |
|
|
56 |
9. Copy files |
|
57 |
|
|
58 |
9.1[beta] In /srv/claims/records/ folder of beta run copy.sh script |
|
59 |
set date in case you don't want to get them all (but all are new anyway) |
|
60 |
9.2 [prod] copy new records folder in production add in /srv/claims/ folder |
|
61 |
|
|
62 |
9.3 [prod] in /srv/claims/ folder run copyToProduction.sh script |
|
63 |
|
|
64 |
|
|
65 |
|
modules/uoa-claims/trunk/src/main/java/eu/dnetlib/data/claims/migration/updateField.sql | ||
---|---|---|
1 |
-- add column |
|
2 |
#altered in beta & production |
|
3 |
#ALTER TABLE claim ADD COLUMN claimed_in_dashboard varchar(50); |
|
4 |
|
|
5 |
-- update column with specific value: |
|
6 |
#run in production 25-11-2019select |
|
7 |
#UPDATE claim SET claimed_in_dashboard = 'production_explore'; |
|
8 |
|
|
9 |
-- update claims linked to a community |
|
10 |
#run in beta 25-11-2019 |
|
11 |
#UPDATE claim SET claimed_in_dashboard = concat('beta_connect_',split_part(source_id,'::',1)) where source_type = 'context' and claim_date between '2018-03-01' and '2019-12-31' ; |
|
12 |
|
|
13 |
--which users claims since connect release |
|
14 |
select claimedby,claimed_in_dashboard, source_id, target_id from claim where claim_date between '2018-03-01' and '2019-12-31'; |
|
15 |
|
|
16 |
|
|
17 |
-- update claims made by a community user/manager |
|
18 |
#run in beta 25-11-2019 |
|
19 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_ni' where ( claimedby = 'sorina.pop@creatis.insa-lyon.fr' or claimedby = 'xavier.rolland@inria.fr' or claimedby = 'micheL.dojat@inserm.fr' or claimedby = 'camille.maumet@inria.fr') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
20 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_elexir-gr' where ( claimedby = 'schatz@imis.athena-innovation.gr' or claimedby = 'vergoulis@imis.athena-innovation.gr' ) and claim_date between '2018-03-01' and '2019-12-31' ; |
|
21 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_fam' where ( claimedby = 'taha.imzilen@ird.fr' or claimedby = 'bastien.merigot@umontpellier.fr' or claimedby = 'paul.taconet@ird.fr' or claimedby = 'julien.barde@ird.fr') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
22 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_mes' where ( claimedby = 'spesant@marum.de' or claimedby = 'javier.moreno@gm.uca.es') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
23 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_ni' where ( claimedby = 'sorina.pop@creatis.insa-lyon.fr' or claimedby = 'xavier.rolland@inria.fr' or claimedby = 'micheL.dojat@inserm.fr' or claimedby = 'camille.maumet@inria.fr') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
24 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_rda' where ( claimedby = 'ilaria.fava@gmail.com') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
25 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_dh-ch' where ( claimedby = 'achille.felicetti@gmail.com' or claimedby = 'francesca.murano@unifi.it' or claimedby = 'sokhi.huda@uinsby.ac.id') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
26 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_ee' where ( claimedby = 'evita.mailli@icre8.eu' or claimedby = 'avassilopoulos.aua@gmail.com' or claimedby = 'ebun.akinsete@icre8.eu') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
27 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_dariah' where ( claimedby = 'erzsebet.toth-czifra@dariah.eu') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
28 |
|
|
29 |
# init rest values with explore |
|
30 |
select claimedby,claimed_in_dashboard, source_id, target_id from claim where claimed_in_dashboard is null; |
|
31 |
#run in beta 25-11-2019 |
|
32 |
#UPDATE claim SET claimed_in_dashboard = 'beta_explore' where claimed_in_dashboard is null; |
|
33 |
-- |
|
34 |
|
|
35 |
|
|
36 |
#if the properties file is cached and there is no value for dashboard, the claimed_in_dashboard value may be 'production_undefined'. Correct with: |
|
37 |
# select * from claim where claimed_in_dashboard = 'production_undefined' ; |
|
38 |
#UPDATE claim SET claimed_in_dashboard = 'production_explore' where claimed_in_dashboard = 'production_undefined' ; |
|
39 |
-- |
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
select * from claim where claim_date between '2018-03-01' and '2019-12-31' and ( claimed_in_dashboard ='beta_connect_mes' or claimed_in_dashboard ='beta_connect_ee' or claimed_in_dashboard ='beta_connect_ni' or claimed_in_dashboard ='beta_connect_dh-ch' or claimed_in_dashboard ='beta_connect_fam'); |
modules/uoa-claims/trunk/src/main/java/eu/dnetlib/data/claims/utils/QueryGenerator.java | ||
---|---|---|
750 | 750 |
if(i > 0){ |
751 | 751 |
clause = clause.concat(" or "); |
752 | 752 |
} |
753 |
clause = clause.concat(" claim.claimed_in_dashboard = ?"); |
|
753 |
clause = clause.concat(" claim.claimed_in_dashboard = ? or source_id = ?");
|
|
754 | 754 |
clauseParams.add("beta_connect_"+dashboards.get(i)); |
755 |
clauseParams.add(dashboards.get(i)); |
|
755 | 756 |
} |
756 | 757 |
if(dashboards.size()>0){ |
757 | 758 |
clause = clause.concat(")"); |
modules/uoa-claims/trunk/src/main/resources/eu/dnetlib/data/claims/migration/stepsTomigrateFromBetaToProduction | ||
---|---|---|
1 |
1.[beta] work on beta |
|
2 |
1.1 connect to beta |
|
3 |
ssh argiro.kokogiannaki@beta.services.openaire.eu |
|
4 |
1.2 Export tables from beta |
|
5 |
pg_dump -U dnet -h localhost dnet_openaireplus -t context -t project -t result -t has_source_context -t has_source_project -t has_source_result -t has_target_project -t has_target_result -t claim -t notification --password >claims20190720.sql |
|
6 |
|
|
7 |
pg_dump --column-inserts --data-only -U dnet -h localhost dnet_openaireplus -t notification --password >notifications20190801.sql |
|
8 |
1.3 Get records |
|
9 |
|
|
10 |
ll /srv/claims/records/ |
|
11 |
tar -czvf records.beta.20190801.tar.gz /srv/claims/records/ |
|
12 |
scp records.beta.20190801.tar.gz argirok@scoobydoo.di.uoa.gr:~/ |
|
13 |
|
|
14 |
2. dump in local db |
|
15 |
|
|
16 |
2.1 create local db |
|
17 |
create database claims_beta |
|
18 |
|
|
19 |
|
|
20 |
2.2 insert records |
|
21 |
psql -h localhost -U postgres claims_beta --password < claims20190720.sql |
|
22 |
|
|
23 |
|
|
24 |
3. prepare db to put new records |
|
25 |
|
|
26 |
3.1 create db |
|
27 |
create database claims_prod |
|
28 |
|
|
29 |
3.2 create claim tables for local db |
|
30 |
|
|
31 |
3.3 set sequence numbers not to override anything in production: |
|
32 |
ALTER SEQUENCE result_id_seq RESTART WITH 20000; ALTER SEQUENCE claim_id_seq RESTART WITH 13000; |
|
33 |
|
|
34 |
|
|
35 |
4. Run Java migration |
|
36 |
|
|
37 |
5. export prod records |
|
38 |
|
|
39 |
pg_dump --column-inserts --data-only -U postgres -h localhost movedb -t context -t project -t result -t has_source_context -t has_source_project -t has_source_result -t has_target_project -t has_target_result -t claim -t --password >claims_new_20190720.sql |
|
40 |
|
|
41 |
6. [prod] set sequence numbers after the ids of the new claims |
|
42 |
psql -h postgresql.services.openaire.eu dnet_openaireplus -U dnet |
|
43 |
ALTER SEQUENCE result_id_seq RESTART WITH 11000; ALTER SEQUENCE claim_id_seq RESTART WITH 12800; |
|
44 |
|
|
45 |
7.[prod] |
|
46 |
|
|
47 |
7.1 insert records in production db |
|
48 |
psql -U dnet -h postgresql.services.openaire.eu dnet_openaireplus --password < claims_new_20190720.sql |
|
49 |
|
|
50 |
8.[prod] notifications in production |
|
51 |
|
|
52 |
8.1 insert notifications records in production db |
|
53 |
psql -U dnet -h postgresql.services.openaire.eu dnet_openaireplus --password < notifications20190801.sql |
|
54 |
|
|
55 |
|
|
56 |
9. Copy files |
|
57 |
|
|
58 |
9.1[beta] In /srv/claims/records/ folder of beta run copy.sh script |
|
59 |
set date in case you don't want to get them all (but all are new anyway) |
|
60 |
9.2 [prod] copy new records folder in production add in /srv/claims/ folder |
|
61 |
|
|
62 |
9.3 [prod] in /srv/claims/ folder run copyToProduction.sh script |
|
63 |
|
|
64 |
|
|
65 |
|
modules/uoa-claims/trunk/src/main/resources/eu/dnetlib/data/claims/migration/updateField.sql | ||
---|---|---|
1 |
-- add column |
|
2 |
#altered in beta & production |
|
3 |
#ALTER TABLE claim ADD COLUMN claimed_in_dashboard varchar(50); |
|
4 |
|
|
5 |
-- update column with specific value: |
|
6 |
#run in production 25-11-2019select |
|
7 |
#UPDATE claim SET claimed_in_dashboard = 'production_explore'; |
|
8 |
|
|
9 |
-- update claims linked to a community |
|
10 |
#run in beta 25-11-2019 |
|
11 |
#UPDATE claim SET claimed_in_dashboard = concat('beta_connect_',split_part(source_id,'::',1)) where source_type = 'context' and claim_date between '2018-03-01' and '2019-12-31' ; |
|
12 |
|
|
13 |
--which users claims since connect release |
|
14 |
select claimedby,claimed_in_dashboard, source_id, target_id from claim where claim_date between '2018-03-01' and '2019-12-31'; |
|
15 |
|
|
16 |
|
|
17 |
-- update claims made by a community user/manager |
|
18 |
#run in beta 25-11-2019 |
|
19 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_ni' where ( claimedby = 'sorina.pop@creatis.insa-lyon.fr' or claimedby = 'xavier.rolland@inria.fr' or claimedby = 'micheL.dojat@inserm.fr' or claimedby = 'camille.maumet@inria.fr') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
20 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_elexir-gr' where ( claimedby = 'schatz@imis.athena-innovation.gr' or claimedby = 'vergoulis@imis.athena-innovation.gr' ) and claim_date between '2018-03-01' and '2019-12-31' ; |
|
21 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_fam' where ( claimedby = 'taha.imzilen@ird.fr' or claimedby = 'bastien.merigot@umontpellier.fr' or claimedby = 'paul.taconet@ird.fr' or claimedby = 'julien.barde@ird.fr') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
22 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_mes' where ( claimedby = 'spesant@marum.de' or claimedby = 'javier.moreno@gm.uca.es') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
23 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_ni' where ( claimedby = 'sorina.pop@creatis.insa-lyon.fr' or claimedby = 'xavier.rolland@inria.fr' or claimedby = 'micheL.dojat@inserm.fr' or claimedby = 'camille.maumet@inria.fr') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
24 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_rda' where ( claimedby = 'ilaria.fava@gmail.com') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
25 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_dh-ch' where ( claimedby = 'achille.felicetti@gmail.com' or claimedby = 'francesca.murano@unifi.it' or claimedby = 'sokhi.huda@uinsby.ac.id') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
26 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_ee' where ( claimedby = 'evita.mailli@icre8.eu' or claimedby = 'avassilopoulos.aua@gmail.com' or claimedby = 'ebun.akinsete@icre8.eu') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
27 |
#UPDATE claim SET claimed_in_dashboard = 'beta_connect_dariah' where ( claimedby = 'erzsebet.toth-czifra@dariah.eu') and claim_date between '2018-03-01' and '2019-12-31' ; |
|
28 |
|
|
29 |
# init rest values with explore |
|
30 |
select claimedby,claimed_in_dashboard, source_id, target_id from claim where claimed_in_dashboard is null; |
|
31 |
#run in beta 25-11-2019 |
|
32 |
#UPDATE claim SET claimed_in_dashboard = 'beta_explore' where claimed_in_dashboard is null; |
|
33 |
-- |
|
34 |
|
|
35 |
|
|
36 |
#if the properties file is cached and there is no value for dashboard, the claimed_in_dashboard value may be 'production_undefined'. Correct with: |
|
37 |
# select * from claim where claimed_in_dashboard = 'production_undefined' ; |
|
38 |
#UPDATE claim SET claimed_in_dashboard = 'production_explore' where claimed_in_dashboard = 'production_undefined' ; |
|
39 |
-- |
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
select * from claim where claim_date between '2018-03-01' and '2019-12-31' and ( claimed_in_dashboard ='beta_connect_mes' or claimed_in_dashboard ='beta_connect_ee' or claimed_in_dashboard ='beta_connect_ni' or claimed_in_dashboard ='beta_connect_dh-ch' or claimed_in_dashboard ='beta_connect_fam'); |
Also available in: Unified diff
Updates to Migrate community claims from Beta to Production