[Port to dtq-dev] Issue dspace-customers#903: drop hardcoded public. schema prefix from CLARIN migrations - #1406
Open
jr-rk wants to merge 1 commit into
Open
[Port to dtq-dev] Issue dspace-customers#903: drop hardcoded public. schema prefix from CLARIN migrations#1406jr-rk wants to merge 1 commit into
jr-rk wants to merge 1 commit into
Conversation
The V7.2 Lindat/Clarin and V7.6 Preview migrations qualified their `ALTER TABLE ... OWNER TO dspace` statements with `public.`, so instances whose DSpace tables live in a non-public schema could not run them. Remove the qualifier (17 statements across the two files) so each resolves against the connection's search_path. The unrelated bitstore.xml storage-bean swap from the source commit is omitted -- dtq-dev already uses SyncBitstreamStorageServiceImpl. Port of dataquest-dev/dspace-customers#903 (item 5). Source: customer/vsb-tuo e2fb083. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates two CLARIN-specific PostgreSQL Flyway migrations to avoid hardcoding the public. schema in ALTER TABLE … OWNER TO dspace statements, allowing the migrations to run correctly when DSpace tables live in a non-public schema (via the connection search_path).
Changes:
- Removed
public.schema qualification from 14ALTER TABLE … OWNER TO dspacestatements in the Lindat/Clarin upgrade migration (V7.2). - Removed
public.schema qualification from 3ALTER TABLE … OWNER TO dspacestatements in the preview tables migration (V7.6).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V7.2_2022.07.28__Upgrade_to_Lindat_Clarin_schema.sql |
Drops public. qualifiers from ALTER TABLE … OWNER TO dspace so ownership changes resolve via search_path. |
dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V7.6_2024.08.05__Added_Preview_Tables.sql |
Drops public. qualifiers from ALTER TABLE … OWNER TO dspace for preview tables/sequences to support non-public schemas. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
milanmajchrak
requested changes
Aug 14, 2026
milanmajchrak
left a comment
Collaborator
There was a problem hiding this comment.
We cannot update already existing flyway scripts because there will be mismatch with the Flyway checksum. You need to create a new Flyway script.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Two CLARIN Flyway migrations hardcode the
public.schema prefix in theirALTER TABLE … OWNER TO dspacestatements. Instances whose DSpace tables live in a non-publicschema cannot run these migrations.Port of dataquest-dev/dspace-customers#903 (item 5). Source:
customer/vsb-tuoe2fb08358e.Root cause
ALTER TABLE public.<name> OWNER TO dspacebinds the statement to thepublicschema instead of the connection'ssearch_path. Dropping the qualifier lets each statement resolve against whatever schema the DSpace role actually uses.Change set
V7.2_2022.07.28__Upgrade_to_Lindat_Clarin_schema.sql— 14ALTER TABLE public.X→ALTER TABLE X.V7.6_2024.08.05__Added_Preview_Tables.sql— 3ALTER TABLE public.X→ALTER TABLE X.Only the
public.-qualifiedALTER TABLEstatements change;-- … Schema: publiccomments are untouched. The unrelatedbitstore.xmlhunk in the source commit (BitstreamStorageServiceImpl→SyncBitstreamStorageServiceImpl) is excluded — it is a storage-bean swap unrelated to schema qualification, anddtq-devalready usesSyncBitstreamStorageServiceImpl.Test evidence
Risk & rollback —⚠️ FLYWAY CHECKSUM, NEEDS HUMAN REVIEW
These are already-applied migrations, so editing their content changes their Flyway checksum. Instances that already ran V7.2 / V7.6 with the old text will fail
flyway validateon next startup unless aflyway repairis run there. Please confirm before merge:public-schema installs: safe and required (statements now resolve correctly).public-schema installs (dtq-dev/ufal): will need a one-timeflyway repair(checksum re-baseline). No data change — only the recorded checksum.Per
reference/backend-stack.md, Flyway migrations are append-only; this edit is an intentional, reviewed exception matching the customer report's "unconditionally safe" assessment for the affected instances. Flagging explicitly rather than assuming.Required upgrade step (existing installs)
Any instance that already ran V7.2 / V7.6 (dtq-dev, ufal, downstream CLARIN) must run a one-time Flyway repair after deploying this change, so the recorded checksums are re-baselined to the edited files:
This rewrites only the checksums in the
flyway_schema_historytable — no schema or data change. Without it, the next startup that carries any pending migration failsflyway validateon V7.2 / V7.6. Fresh installs need no action.Notes / assumptions
Pure DDL-qualifier change; no schema/data semantics change.