Skip to content

Create cohort_characterization_version on installs from the 3.0 baseline - #2570

Merged
chrisknoll merged 1 commit into
masterfrom
p-hoffmann/cc-version-table
Nov 3, 2026
Merged

chrisknoll merged 1 commit into
masterfrom
p-hoffmann/cc-version-table

Conversation

@p-hoffmann

Copy link
Copy Markdown
Member

The B2.99.0006 baseline has no cohort_characterization_version table. On a fresh 3.0 install, every characterization update therefore fails with HTTP 500 SQLGrammarException (relation "webapi.cohort_characterization_version" does not exist) while saving the previous version, and the characterization version list fails the same way. This adds a migration that creates the table if it is missing. Databases upgraded from 2.x already have it, so there it is a no-op. The version is above 3.0.0 so installs baselined at 3.0.0 still pick it up.

Reported in OHDSI/Atlas3#436.

The B2.99.0006 baseline creates the version tables for cohorts, concept
sets, incidence rates, pathways and reusables but not for
characterizations, so on a fresh install every characterization update
fails with SQLGrammarException while saving the previous version.
Create the table if it is missing; databases upgraded from 2.x already
have it.

@chrisknoll chrisknoll left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for duplication: we shouldn't make migration scripts conditional (via 'if not exists').

the baseline migration has the bug, we should fix this issue there.

@chrisknoll

Copy link
Copy Markdown
Collaborator

Hi, I reflected on this more and it's a special case of an if-exists for a baseline migration problem. So I think i'll accept the if exist one but future tables should be created without 'if exists' this is only a special case.

@chrisknoll
chrisknoll merged commit 384812f into master Nov 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants