Revision 8642
Added by ben leinfelder over 10 years ago
lib/metacat.properties | ||
---|---|---|
91 | 91 |
database.upgradeUtility.1.5.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade1_5_0 |
92 | 92 |
database.upgradeUtility.2.0.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade2_0_0 |
93 | 93 |
database.upgradeUtility.2.3.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade2_3_0 |
94 |
database.upgradeUtility.2.4.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade2_4_0 |
|
94 | 95 |
database.initialConnections=5 |
95 | 96 |
database.incrementConnections=5 |
96 | 97 |
# be sure to increase SQL connection limits accordingly: |
src/upgrade-db-to-2.4.0-postgres.sql | ||
---|---|---|
9 | 9 |
* Then we know the current version should be restored |
10 | 10 |
*/ |
11 | 11 |
|
12 |
DROP TABLE IF EXISTS current_documents; |
|
13 |
CREATE TABLE current_documents ( |
|
14 |
guid text, |
|
15 |
obsoleted_by text |
|
16 |
); |
|
17 |
|
|
12 | 18 |
/* Find the most recent version by traversing system metadata |
13 | 19 |
* see: http://www.postgresql.org/docs/8.4/static/queries-with.html |
14 | 20 |
*/ |
15 |
DROP TABLE IF EXISTS current_documents;
|
|
21 |
INSERT INTO current_documents (guid, obsoleted_by)
|
|
16 | 22 |
WITH RECURSIVE q AS |
17 | 23 |
( |
18 | 24 |
SELECT id.guid, sm.obsoleted_by |
... | ... | |
30 | 36 |
ON q.obsoleted_by = newer.guid |
31 | 37 |
) |
32 | 38 |
SELECT guid, obsoleted_by |
33 |
INTO current_documents |
|
34 | 39 |
FROM q |
35 | 40 |
WHERE obsoleted_by is null |
36 | 41 |
ORDER BY guid; |
src/edu/ucsb/nceas/metacat/admin/upgrade/Upgrade2_4_0.java | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile$' |
|
3 |
* Copyright: 2013 Regents of the University of California and the |
|
4 |
* National Center for Ecological Analysis and Synthesis |
|
5 |
* |
|
6 |
* '$Author$' |
|
7 |
* '$Date$' |
|
8 |
* '$Revision$' |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or modify |
|
11 |
* it under the terms of the GNU General Public License as published by |
|
12 |
* the Free Software Foundation; either version 2 of the License, or |
|
13 |
* (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
*/ |
|
24 |
|
|
25 |
package edu.ucsb.nceas.metacat.admin.upgrade; |
|
26 |
|
|
27 |
import java.io.IOException; |
|
28 |
import java.security.NoSuchAlgorithmException; |
|
29 |
|
|
30 |
import edu.ucsb.nceas.metacat.admin.AdminException; |
|
31 |
import edu.ucsb.nceas.metacat.admin.upgrade.solr.SolrSchemaModificationException; |
|
32 |
import edu.ucsb.nceas.metacat.admin.upgrade.solr.SolrSchemaUpgrader; |
|
33 |
import edu.ucsb.nceas.metacat.shared.ServiceException; |
|
34 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* Upgrade the application to version 2.4.0. |
|
40 |
* @author tao |
|
41 |
* |
|
42 |
*/ |
|
43 |
public class Upgrade2_4_0 implements UpgradeUtilityInterface { |
|
44 |
|
|
45 |
public boolean upgrade() throws AdminException { |
|
46 |
boolean success = true; |
|
47 |
try { |
|
48 |
SolrSchemaUpgrader upgrader = new SolrSchemaUpgrader(); |
|
49 |
upgrader.upgrade(); |
|
50 |
} catch (PropertyNotFoundException e) { |
|
51 |
throw new AdminException(e.getMessage()); |
|
52 |
} catch (IOException e){ |
|
53 |
throw new AdminException(e.getMessage()); |
|
54 |
} catch(NoSuchAlgorithmException e) { |
|
55 |
throw new AdminException(e.getMessage()); |
|
56 |
} catch (ServiceException e) { |
|
57 |
throw new AdminException(e.getMessage()); |
|
58 |
} catch ( SolrSchemaModificationException e) { |
|
59 |
throw e; |
|
60 |
} |
|
61 |
return success; |
|
62 |
} |
|
63 |
|
|
64 |
} |
|
0 | 65 |
Also available in: Unified diff
merge recent upgrade changes from 2.4 branch