forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 7932-zip-download-limit
- Loading branch information
Showing
10 changed files
with
248 additions
and
102 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### Upgrade Notes | ||
|
||
**If your installation relies on the database-side stored procedure for generating sequential numeric identifiers:** | ||
|
||
*(Note: You can skip the following paragraph if your installation uses the default-style, randomly-generated six alphanumeric | ||
character-long identifiers for your datasets!)* | ||
|
||
The underlying database framework has been modified in this release, to make it easier for installations | ||
to create custom procedures for generating identifier strings that suit their needs. Your current configuration will | ||
be automatically updated by the database upgrade (Flyway) script incorporated in the release. No manual configuration | ||
changes should be necessary. However, after the upgrade, we recommend that you confirm that your installation can still | ||
create new datasets, and that they are still assigned sequential numeric identifiers. In the unlikely chance that this | ||
is no longer working, please re-create the stored procedure following the steps described in the documentation for the | ||
`:IdentifierGenerationStyle` setting in the *Configuration* section of the Installation Guide for this release (v5.6). | ||
(Running the script supplied there will NOT overwrite the position on the sequence you are currently using!) |
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
46 changes: 46 additions & 0 deletions
46
doc/sphinx-guides/source/_static/util/identifier_from_timestamp.sql
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,46 @@ | ||
-- A script for creating, through a database stored procedure, sequential | ||
-- 8 character identifiers from a base36 representation of current timestamp. | ||
|
||
CREATE OR REPLACE FUNCTION base36_encode( | ||
IN digits bigint, IN min_width int = 0) | ||
RETURNS varchar AS $$ | ||
DECLARE | ||
chars char[]; | ||
ret varchar; | ||
val bigint; | ||
BEGIN | ||
chars := ARRAY[ | ||
'0','1','2','3','4','5','6','7','8','9', | ||
'a','b','c','d','e','f','g','h','i','j', | ||
'k','l','m','n','o','p','q','r','s','t', | ||
'u','v','w','x','y','z']; | ||
val := digits; | ||
ret := ''; | ||
IF val < 0 THEN | ||
val := val * -1; | ||
END IF; | ||
WHILE val != 0 LOOP | ||
ret := chars[(val % 36)+1] || ret; | ||
val := val / 36; | ||
END LOOP; | ||
|
||
IF min_width > 0 AND char_length(ret) < min_width THEN | ||
ret := lpad(ret, min_width, '0'); | ||
END IF; | ||
|
||
RETURN ret; | ||
END; | ||
$$ LANGUAGE plpgsql IMMUTABLE; | ||
|
||
|
||
CREATE OR REPLACE FUNCTION generateIdentifierFromStoredProcedure() | ||
RETURNS varchar AS $$ | ||
DECLARE | ||
curr_time_msec bigint; | ||
identifier varchar; | ||
BEGIN | ||
curr_time_msec := extract(epoch from now())*1000; | ||
identifier := base36_encode(curr_time_msec); | ||
RETURN identifier; | ||
END; | ||
$$ LANGUAGE plpgsql IMMUTABLE; |
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
Oops, something went wrong.