Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
igea-jure authored and fxprunayre committed Jun 6, 2024
1 parent 0758a8e commit d5ae02f
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jdbc.basic.minEvictableIdleTimeMillis=1800000
jdbc.basic.testWhileIdle=true
jdbc.basic.numTestsPerEvictionRun=5
jdbc.basic.poolPreparedStatements=true
jdbc.basic.maxOpenPreparedStatements=1200
jdbc.basic.maxOpenPreparedStatements=50
jdbc.basic.validationQuery=SELECT 1
jdbc.basic.defaultReadOnly=false
jdbc.basic.defaultAutoCommit=false
2 changes: 1 addition & 1 deletion web/src/main/webResources/WEB-INF/config-db/oracle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</bean>

<bean id="jdbcURL" class="java.lang.String">
<constructor-arg value="jdbc:oracle:thin:@${jdbc.host}:${jdbc.port:1521}:${jdbc.database}"/>
<constructor-arg value="jdbc:oracle:thin:@${jdbc.host}:${jdbc.port:1521}/${jdbc.database}"/>
</bean>

</beans>
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
UPDATE Settings SET value='3.10.3' WHERE name='system/platform/version';
UPDATE Settings SET value='0' WHERE name='system/platform/subVersion';

ALTER TABLE groupsdes ALTER COLUMN label TYPE varchar(255);
ALTER TABLE sourcesdes ALTER COLUMN label TYPE varchar(255);
ALTER TABLE schematrondes ALTER COLUMN label TYPE varchar(255);
ALTER TABLE groupsdes MODIFY label varchar(255);
ALTER TABLE sourcesdes MODIFY label varchar(255);
ALTER TABLE schematrondes MODIFY label varchar(255);

-- New setting for server timezone
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/server/timeZone', '', 0, 260, 'n');

-- keep these at the bottom of the file!
DROP INDEX idx_metadatafiledownloads_metadataid;
DROP INDEX idx_metadatafileuploads_metadataid;
DROP INDEX idx_operationallowed_metadataid;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ UPDATE Settings SET value='3.11.0' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';

-- Increase the length of Validation type (where the schematron file name is stored)
ALTER TABLE Validation ALTER COLUMN valType TYPE varchar(128);
ALTER TABLE Validation MODIFY valType varchar(128);

ALTER TABLE usersearch ADD (tempurl clob);
ALTER TABLE usersearch SET tempurl = url, url = null;
UPDATE usersearch SET tempurl = url, url = null;
ALTER TABLE usersearch DROP COLUMN url;
ALTER TABLE usersearch RENAME COLUMN tempurl to url;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
-- Consider running the following script before upgrading. It will resequence all sequences,
-- so that UpdateAllSequenceValueToMax.java won't hang if sequences are way out of sync.
--
-- declare
-- type t_seq_tab is record (sequence_name varchar2(255), table_name varchar2(255));
-- type nt_seq_tab is table of t_seq_tab;
-- v_seq_tab nt_seq_tab := nt_seq_tab(
-- t_seq_tab('ADDRESS_ID_SEQ' , 'ADDRESS')
-- ,t_seq_tab('CSW_SERVER_CAPABILITIES_INFO_ID_SEQ', 'CSWSERVERCAPABILITIESINFO')
-- ,t_seq_tab('FILES_ID_SEQ' , 'FILES')
-- ,t_seq_tab('GROUP_ID_SEQ' , 'GROUPS')
-- ,t_seq_tab('GUFKEY_ID_SEQ' , 'GUF_KEYWORDS')
-- ,t_seq_tab('GUFRAT_ID_SEQ' , 'GUF_RATING')
-- ,t_seq_tab('HARVESTER_SETTING_ID_SEQ' , 'HARVESTERSETTINGS')
-- ,t_seq_tab('HARVEST_HISTORY_ID_SEQ' , 'HARVESTHISTORY')
-- ,t_seq_tab('INSPIRE_ATOM_FEED_ID_SEQ' , 'INSPIREATOMFEED')
-- ,t_seq_tab('ISO_LANGUAGE_ID_SEQ' , 'ISOLANGUAGES')
-- ,t_seq_tab('MAPSERVER_ID_SEQ' , 'MAPSERVERS')
-- ,t_seq_tab('METADATA_CATEGORY_ID_SEQ' , 'CATEGORIES')
-- ,t_seq_tab('METADATA_FILEDOWNLOAD_ID_SEQ' , 'METADATAFILEDOWNLOADS')
-- ,t_seq_tab('METADATA_FILEUPLOAD_ID_SEQ' , 'METADATAFILEUPLOADS')
-- ,t_seq_tab('METADATA_IDENTIFIER_TEMPLATE_ID_SEQ', 'METADATAIDENTIFIERTEMPLATE')
-- ,t_seq_tab('METADATA_ID_SEQ' , 'METADATA')
-- ,t_seq_tab('METADATA_NOTIFIER_ID_SEQ' , 'METADATANOTIFIERS')
-- ,t_seq_tab('OPERATION_ID_SEQ' , 'OPERATIONS')
-- ,t_seq_tab('RATING_CRITERIA_ID_SEQ' , 'GUF_RATINGCRITERIA')
-- ,t_seq_tab('SCHEMATRON_CRITERIA_ID_SEQ' , 'SCHEMATRONCRITERIA')
-- ,t_seq_tab('SCHEMATRON_ID_SEQ' , 'SCHEMATRON')
-- ,t_seq_tab('SELECTION_ID_SEQ' , 'SELECTIONS')
-- ,t_seq_tab('SERVICE_ID_SEQ' , 'SERVICES')
-- ,t_seq_tab('SERVICEPARAMETERS_ID_SEQ' , 'SERVICEPARAMETERS')
-- ,t_seq_tab('STATUS_VALUE_ID_SEQ' , 'STATUSVALUES')
-- ,t_seq_tab('USER_ID_SEQ' , 'USERS')
-- );
-- v_pk varchar2(255);
-- v_max number;
-- v_stmt varchar2(1000);
-- begin
-- for i in 1..v_seq_tab.count loop
-- select cc.column_name
-- into v_pk
-- from user_constraints c
-- join user_cons_columns cc on (c.constraint_name = cc.constraint_name)
-- where c.table_name = v_seq_tab(i).table_name
-- and c.constraint_type = 'P';
-- execute immediate 'select max(' || v_pk || ') from ' || v_seq_tab(i).table_name into v_max;
-- v_stmt := 'alter sequence ' || v_seq_tab(i).sequence_name || ' restart start with ' || to_number(nvl(v_max, 0) + 1);
-- dbms_output.put_line( v_stmt);
-- execute immediate v_stmt;
-- end loop;
-- end;
-- /


DROP TABLE metadatanotifications;
DROP TABLE metadatanotifiers;

DELETE FROM Settings WHERE name LIKE 'system/indexoptimizer%';
DELETE FROM Settings WHERE name LIKE 'system/requestedLanguage%';
DELETE FROM Settings WHERE name = 'system/inspire/enableSearchPanel';
DELETE FROM Settings WHERE name = 'system/autodetect/enable';

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/index/indexingTimeRecordLink', 'false', 2, 9209, 'n');

UPDATE metadata
SET data = REGEXP_REPLACE(data, '[a-z]{3}\/thesaurus\.download\?ref=', 'api/registries/vocabularies/')
WHERE data LIKE '%thesaurus.download?ref=%';

UPDATE settings SET value = '1' WHERE name = 'system/threadedindexing/maxthreads';

UPDATE Settings SET value='4.0.0' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

-- Set default timezone to UTC if not set.
UPDATE Settings SET value = 'Etc/UTC' WHERE name = 'system/server/timeZone' AND VALUE is null;

-- eg. CET
-- UPDATE Settings SET value = 'Europe/Copenhagen' WHERE name = 'system/server/timeZone' AND VALUE = '';

-- Check
-- SELECT value FROM Settings WHERE name = 'system/server/timeZone';

-- From 4.0.2 version, db dates MUST be in UTC.

-- Check db dates timezone (usually server timezone)
-- * Server timezone eg. date +"%Z %z"
-- UTC +0000
-- CET +0100
--
-- * DB timezone
-- SHOW timezone;
-- UTC

-- * Server timezone setting = DB timezone = UTC = Nothing to update. Will only add Z
-- 2020-10-29T16:11:55 > 2020-10-29T16:11:55Z
-- * Server timezone setting != UTC.
-- Shift old DB dates from server timezone to UTC
-- eg. for CET
-- UPDATE metadata SET (createdate, changedate) = (
-- to_char(
-- timezone('UTC',
-- to_timestamp(createDate, 'YYYY-MM-DDThh24:mi:ss')
-- AT TIME ZONE (SELECT value FROM Settings WHERE name = 'system/server/timeZone')), 'YYYY-MM-DDThh24:mi:ssZ'),
-- to_char(
-- timezone('UTC',
-- to_timestamp(changedate, 'YYYY-MM-DDThh24:mi:ss')
-- AT TIME ZONE (SELECT value FROM Settings WHERE name = 'system/server/timeZone')), 'YYYY-MM-DDThh24:mi:ssZ')
-- ) WHERE length(createdate) = 19 AND length(changedate) = 19;

-- column GUF_UserFeedback_uuid is magically added by the application (Hibernate?)
--ALTER TABLE guf_userfeedbacks_guf_rating ADD GUF_UserFeedback_uuid varchar(255);
UPDATE guf_userfeedbacks_guf_rating SET GUF_UserFeedback_uuid = GUF_UserFeedbacks_uuid;
ALTER TABLE guf_userfeedbacks_guf_rating DROP COLUMN GUF_UserFeedbacks_uuid;

UPDATE Settings SET value='4.0.2' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/inspire/remotevalidation/nodeid', '', 0, 7212, 'n');

-- Changes were back ported to version 3.12.x so they are no longer required unless upgrading from previous v40x which did not have 3.12.x migrations steps.
-- So lets try to only add the records if they don't already exists.
INSERT INTO Settings (name, value, datatype, position, internal) SELECT distinct 'system/inspire/remotevalidation/apikey', '', 0, 7213, 'y' from settings WHERE NOT EXISTS (SELECT name FROM Settings WHERE name = 'system/inspire/remotevalidation/apikey');
INSERT INTO Settings (name, value, datatype, position, internal) SELECT distinct 'system/publication/doi/doipublicurl', '', 0, 100196, 'n' from settings WHERE NOT EXISTS (SELECT name FROM Settings WHERE name = 'system/publication/doi/doipublicurl');

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/harvester/enablePrivilegesManagement', 'false', 2, 9010, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/localrating/notificationLevel', 'catalogueAdministrator', 0, 2111, 'n');

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/preferredGroup', '', 1, 9105, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadatacreate/preferredTemplate', '', 0, 9106, 'n');

DELETE FROM Settings WHERE name = 'system/server/securePort';

UPDATE Settings SET value = '0 0 0 * * ?' WHERE name = 'system/inspire/atomSchedule' and to_char(value) = '0 0 0/24 ? * *';

UPDATE Settings SET value='4.0.6' WHERE name='system/platform/version';
UPDATE Settings SET value='0' WHERE name='system/platform/subVersion';
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metadata/csvReport/csvName', 'metadata_{datetime}.csv', 0, 12607, 'n');

UPDATE Settings set position = 7213 WHERE name = 'system/inspire/remotevalidation/nodeid';
UPDATE Settings set position = 7214 WHERE name = 'system/inspire/remotevalidation/apikey';

-- Changes were back ported to version 3.12.x so they are no longer required unless upgrading from previous v40x which did not have 3.12.x migrations steps.
-- So lets try to only add the records if they don't already exists.
INSERT INTO Settings (name, value, datatype, position, internal) SELECT distinct 'system/inspire/remotevalidation/urlquery', '', 0, 7212, 'n' from settings WHERE NOT EXISTS (SELECT name FROM Settings WHERE name = 'system/inspire/remotevalidation/urlquery');
INSERT INTO Settings (name, value, datatype, position, internal) SELECT distinct 'metadata/import/userprofile', 'Editor', 0, 12001, 'n' from settings WHERE NOT EXISTS (SELECT name FROM Settings WHERE name = 'metadata/import/userprofile');

-- for oracle, empty string is the same as null, so we have to make password nullable
ALTER TABLE Users MODIFY password null;
INSERT INTO Users (id, username, password, name, surname, profile, kind, organisation, security, authtype, isenabled) VALUES (0,'nobody','','nobody','nobody',4,'','','','', 'n');
INSERT INTO Address (id, address, city, country, state, zip) VALUES (0, '', '', '', '', '');
INSERT INTO UserAddress (userid, addressid) VALUES (0, 0);

-- WARNING: Security / Add this settings only if you need to allow admin
-- users to be able to reset user password. If you have mail server configured
-- user can reset password directly. If not, then you may want to add that settings
-- if you don't have access to the database.
-- INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/security/password/allowAdminReset', 'false', 2, 12004, 'n');

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metadata/link/excludedUrlPattern', '', 0, 12010, 'n');

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/metadata/thesaurusNamespace', 'https://registry.geonetwork-opensource.org/{{type}}/{{filename}}', 0, 9161, 'n');

UPDATE Settings SET editable = 'n' WHERE name = 'system/userFeedback/lastNotificationDate';
UPDATE Settings SET editable = 'n' WHERE name = 'system/security/passwordEnforcement/pattern';

UPDATE Settings SET value='4.0.7' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE spg_page MODIFY link text;
ALTER TABLE spg_page MODIFY link long;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ALTER TABLE groups MODIFY name varchar(255);

UPDATE Settings SET value='4.4.1' WHERE name='system/platform/version';
UPDATE Settings SET value='0' WHERE name='system/platform/subVersion';

INSERT INTO Settings (name, value, datatype, position, internal) SELECT distinct 'metadata/pdfReport/headerLogoFileName', '', 0, 12508, 'y' from settings WHERE NOT EXISTS (SELECT name FROM Settings WHERE name = 'metadata/pdfReport/headerLogoFileName');

0 comments on commit d5ae02f

Please sign in to comment.