Skip to content

Commit

Permalink
UserSearch / 255 char is too small for URLs (geonetwork#4883)
Browse files Browse the repository at this point in the history
* UserSearch / 255 char is too small for URLs

* UserSearch / 255 char is too small for URLs / SQL migration.

* UserSearch / 255 char is too small for URLs / SQL migration - keep DROP index at the end.

* UserSearch / 255 char is too small for URLs / SQL migration - Thanks @ianwallen for Oracle hint.

* UserSearch / 255 char is too small for URLs / SQL migration.
  • Loading branch information
fxprunayre authored Sep 4, 2020
1 parent 2728b88 commit f45a121
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions domain/src/main/java/org/fao/geonet/domain/UserSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import org.fao.geonet.domain.converter.UserSearchFeaturedTypeConverter;
import org.fao.geonet.entitylistener.UserSearchEntityListenerManager;
import org.hibernate.annotations.Type;

import javax.annotation.Nullable;
import javax.persistence.*;
Expand Down Expand Up @@ -58,8 +59,8 @@ public int getId() {
return id;
}


@Column
@Lob
@Type(type = "org.hibernate.type.TextType")
public String getUrl() {
return url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ALTER TABLE Validation ALTER COLUMN valType TYPE varchar(128);
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/server/timeZone', '', 0, 260, 'n');
INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/users/identicon', 'gravatar:mp', 0, 9110, 'n');

ALTER TABLE usersearch ALTER COLUMN url TYPE text;

-- keep these at the bottom of the file!
DROP INDEX idx_metadatafiledownloads_metadataid;
DROP INDEX idx_metadatafileuploads_metadataid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ ALTER TABLE Validation ALTER COLUMN valType TYPE varchar(128);

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

ALTER TABLE usersearch MODIFY url TEXT

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/users/identicon', 'gravatar:mp', 0, 9110, 'n');

DROP INDEX idx_metadatafiledownloads_metadataid ON MetadataFileDownloads;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ ALTER TABLE Validation ALTER COLUMN valType TYPE varchar(128);

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

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

INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('system/users/identicon', 'gravatar:mp', 0, 9110, 'n');

0 comments on commit f45a121

Please sign in to comment.