-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Experimenter.config and lengthen Session.userIP #4762
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6300b01
move SQL scripts ready for new DB patch
mtbc 6a19501
prepare configuration and scripts for DB patch 8
mtbc a229bcc
add map annotation property Experimenter.config
mtbc 7434e47
expand size of Session.userIP for IPv6
mtbc 348243c
regenerate database schema
mtbc c2e8b3f
add SQL for DB upgrade to patch 8
mtbc c6aa250
add integration test for session connections from long IPs
mtbc baca249
fix mistake in upgrade script
mtbc File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
-- Copyright (C) 2012-4 Glencoe Software, Inc. All rights reserved. | ||
-- Use is subject to license terms supplied in LICENSE.txt | ||
-- | ||
-- This program is free software; you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation; either version 2 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- This program is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License along | ||
-- with this program; if not, write to the Free Software Foundation, Inc., | ||
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
-- | ||
|
||
--- | ||
--- OMERO5 development release upgrade from OMERO5.3DEV__7 to OMERO5.3DEV__8. | ||
--- | ||
|
||
BEGIN; | ||
|
||
|
||
-- | ||
-- check OMERO database version | ||
-- | ||
|
||
CREATE OR REPLACE FUNCTION omero_assert_db_version(expected_version VARCHAR, expected_patch INTEGER) RETURNS void AS $$ | ||
|
||
DECLARE | ||
current_version VARCHAR; | ||
current_patch INTEGER; | ||
|
||
BEGIN | ||
SELECT currentversion, currentpatch INTO STRICT current_version, current_patch | ||
FROM dbpatch ORDER BY id DESC LIMIT 1; | ||
|
||
IF current_version <> expected_version OR current_patch <> expected_patch THEN | ||
RAISE EXCEPTION 'wrong OMERO database version for this upgrade script'; | ||
END IF; | ||
|
||
END;$$ LANGUAGE plpgsql; | ||
|
||
SELECT omero_assert_db_version('OMERO5.3DEV', 7); | ||
DROP FUNCTION omero_assert_db_version(varchar, int); | ||
|
||
|
||
-- | ||
-- Actual upgrade | ||
-- | ||
|
||
INSERT INTO dbpatch (currentVersion, currentPatch, previousVersion, previousPatch) | ||
VALUES ('OMERO5.3DEV', 8, 'OMERO5.3DEV', 7); | ||
|
||
ALTER TABLE session ALTER COLUMN userip TYPE VARCHAR(45); | ||
|
||
CREATE TABLE experimenter_config ( | ||
experimenter_id BIGINT NOT NULL, | ||
name TEXT NOT NULL, | ||
value TEXT NOT NULL, | ||
index INTEGER NOT NULL, | ||
PRIMARY KEY (experimenter_id, index), | ||
CONSTRAINT FKexperimenter_config_map | ||
FOREIGN KEY (experimenter_id) REFERENCES experimenter); | ||
|
||
CREATE FUNCTION experimenter_config_map_entry_delete_trigger_function() RETURNS "trigger" AS ' | ||
BEGIN | ||
DELETE FROM experimenter_config | ||
WHERE experimenter_id = OLD.id; | ||
RETURN OLD; | ||
END;' | ||
LANGUAGE plpgsql; | ||
|
||
CREATE TRIGGER experimenter_config_map_entry_delete_trigger | ||
BEFORE DELETE ON experimenter | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE experimenter_config_map_entry_delete_trigger_function(); | ||
|
||
CREATE INDEX experimenter_config_name ON experimenter_config(name); | ||
CREATE INDEX experimenter_config_value ON experimenter_config(value); | ||
|
||
|
||
-- | ||
-- FINISHED | ||
-- | ||
|
||
UPDATE dbpatch SET message = 'Database updated.', finished = clock_timestamp() | ||
WHERE currentVersion = 'OMERO5.3DEV' AND | ||
currentPatch = 8 AND | ||
previousVersion = 'OMERO5.3DEV' AND | ||
previousPatch = 7; | ||
|
||
SELECT CHR(10)||CHR(10)||CHR(10)||'YOU HAVE SUCCESSFULLY UPGRADED YOUR DATABASE TO VERSION OMERO5.3DEV__8'||CHR(10)||CHR(10)||CHR(10) AS Status; | ||
|
||
COMMIT; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the curious reviewer, this imitates an IPv4-mapped IPv6 address from a dual-stack node