-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move index creation from reference_data.sql into Flyway baseline. #7256
- Loading branch information
1 parent
1a122d4
commit fc3dbb6
Showing
2 changed files
with
11 additions
and
13 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
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,11 @@ | ||
-- TODO: we still should add the real base line here, too. That would avoid conflicts between EclipseLink | ||
-- trying to create new tables on existing databases. See https://github.com/IQSS/dataverse/issues/5871 | ||
|
||
-- This is unsupported by JPA, as it is PostgreSQL specific. Has to be done here, cannot be done in code. | ||
-- (Only other option would be a lowercase copy of the data as a separate column, automatically filled py JPA) | ||
CREATE UNIQUE INDEX IF NOT EXISTS dataverse_alias_unique_idx on dataverse (LOWER(alias)); | ||
CREATE UNIQUE INDEX IF NOT EXISTS index_authenticateduser_lower_email ON authenticateduser (lower(email)); | ||
|
||
-- Edit Dataset: Investigate and correct multiple draft issue: https://github.com/IQSS/dataverse/issues/2132 | ||
-- This unique index will prevent the multiple draft issue, yet it cannot be done in JPA code. | ||
CREATE UNIQUE INDEX IF NOT EXISTS one_draft_version_per_dataset ON datasetversion (dataset_id) WHERE versionstate='DRAFT'; |