-
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 baseline script to a 5.1.1 migration, so it …
…will be applied in order (cannot create an older, out-of-order version as this would break migrations for everyone). #7256
- Loading branch information
1 parent
bf96722
commit 92e9609
Showing
2 changed files
with
17 additions
and
9 deletions.
There are no files selected for viewing
9 changes: 0 additions & 9 deletions
9
src/main/resources/db/migration/V1__flyway_schema_baseline.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 |
---|---|---|
@@ -1,11 +1,2 @@ | ||
-- 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'; |
17 changes: 17 additions & 0 deletions
17
src/main/resources/db/migration/V5.1.1.3__7256-purge-referencedata.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,17 @@ | ||
-- #5361 and #7256 is about faster deployments, especially during development, sitting on an empty database. | ||
-- | ||
-- This script has been part of scripts/database/reference_data.sql that had to be executed manually on every new | ||
-- deployment (manually in the sense of Flyway didn't, the outside installer or an admin took care of it). | ||
-- | ||
-- While this is pretty old stuff and should have been done earlier (baseline...), it will be a nice migration | ||
-- and behave like nothing happened if this is an existing installation. All new installation have an empty database | ||
-- on first app boot and benefit from this Flyway-based management. | ||
|
||
-- 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'; |