OHDSI / WebAPI

OHDSI WebAPI contains all OHDSI services that can be called from OHDSI applications
Apache License 2.0
130 stars 169 forks source link

duplicate table issue #1516

Closed hongwonjun closed 4 years ago

hongwonjun commented 4 years ago

Using the CommonDataModel Repository, I built the database. And now I’m trying to run WebAPI.

But, the error below occurs when I try to execute WebAPI.

Migration V1.0.0.3__cohort_definition_persistence.sql failed
------------------------------------------------------------
SQL State  : 42P07
Error Code : 0
Message    : ERROR: relation "cohort_definition" already exists
Location   : db/migration/postgresql/V1.0.0.3__cohort_definition_persistence.sql (/var/lib/tomcat8/webapps/WebAPI/WEB-INF/classes/db/migration/postgresql/V1.0.0.3__cohort_definition_persistence.sql)
Line       : 1
Statement  : CREATE TABLE synpuf5.cohort_definition(
        id int NOT NULL,
        name varchar(255) NOT NULL,
        description varchar(1000) NULL,
        expression_type varchar(50) NULL,
        created_by varchar(255) NULL,
        created_date Timestamp(3) NULL,
        modified_by varchar(255) NULL,
        modified_date Timestamp(3) NULL,
        CONSTRAINT PK_cohort_definition PRIMARY KEY (id)
)

Here is my question.

  1. cohort_definition table is defined differently, is this intentional?
  1. If I want to successfully run it, which of the two duplicated tables do I have to drop?
anthonysena commented 4 years ago

Hi @hongwonjun - WebAPI uses a separate database from your OMOP CDM. It would seem you have configured your WebAPI to use your CDM database (and schema) which will result in the problem reported above. Please take a look at the wiki for an overview of how WebAPI fits into the larger OHDSI ecosystem and for information on setup: https://github.com/OHDSI/WebAPI/wiki#overview

hongwonjun commented 4 years ago

@anthonysena Thank you, it's been resolved.