FraunhoferISST / DataspaceConnector

This is an IDS Connector reference implementation.
https://www.isst.fraunhofer.de/de/geschaeftsfelder/datenwirtschaft/technologien/Dataspace-Connector.html
Apache License 2.0
103 stars 83 forks source link

Initializing Dataspace Connector 7.0.2 fails with postgres 13 #920

Closed phertweck closed 2 years ago

phertweck commented 2 years ago

Describe the bug Initializing Dataspace Connector 7.0.2 fails with postgres 13

To Reproduce Steps to reproduce the behavior:

  1. Deploy Postgres 13
  2. Deploy Dataspace Connector 7.0.2

Initialization fails with the following error message.

Screenshots & Logs

2022-02-22 07:24:57,410 main INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
  ____            _                                                        ____                                         _
 |  _ \    __ _  | |_    __ _   ___   _ __     __ _    ___    ___         / ___|   ___    _ __    _ __     ___    ___  | |_    ___    _ __
 | | | |  / _` | | __|  / _` | / __| | '_ \   / _` |  / __|  / _ \       | |      / _ \  | '_ \  | '_ \   / _ \  / __| | __|  / _ \  | '__|
 | |_| | | (_| | | |_  | (_| | \__ \ | |_) | | (_| | | (__  |  __/       | |___  | (_) | | | | | | | | | |  __/ | (__  | |_  | (_) | | |
 |____/   \__,_|  \__|  \__,_| |___/ | .__/   \__,_|  \___|  \___|        \____|  \___/  |_| |_| |_| |_|  \___|  \___|  \__|  \___/  |_|
 Dataspace Connector                 |_|                                                                                      Version 7.0.2

2022-02-22T07:24:57,735 [main] INFO - Starting ConnectorApplication v7.0.2 using Java 17.0.2 on dataspaceconnector-staging-master-ke8rgq-6f4fd57c75-jgn88 with PID 1 (/app/BOOT-INF/classes started by nonroot in /app)
2022-02-22T07:24:57,802 [main] INFO - No active profile set, falling back to default profiles: default
2022-02-22T07:25:02,739 [main] INFO - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-02-22T07:25:03,195 [main] INFO - Finished Spring Data repository scanning in 401 ms. Found 23 JPA repository interfaces.
2022-02-22T07:25:05,000 [main] INFO - Bean 'dapsTokenValidator' of type [io.dataspaceconnector.config.security.DapsTokenValidator] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-02-22T07:25:05,001 [main] INFO - Bean 'dapsTokenMethodSecurityConfig' of type [io.dataspaceconnector.config.security.DapsTokenMethodSecurityConfig$$EnhancerBySpringCGLIB$$b8567f6d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-02-22T07:25:05,839 [main] INFO - Tomcat initialized with port(s): 8080 (http)
2022-02-22T07:25:05,900 [main] INFO - Initializing ProtocolHandler ["http-nio-8080"]
2022-02-22T07:25:05,900 [main] INFO - Starting service [Tomcat]
2022-02-22T07:25:05,900 [main] INFO - Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-02-22T07:25:06,111 [main] INFO - Initializing Spring embedded WebApplicationContext
2022-02-22T07:25:06,111 [main] INFO - Root WebApplicationContext: initialization completed in 8195 ms
2022-02-22T07:25:06,319 [main] INFO - Creating FilterRegistrationBean bean with TracingFilter mapped to [], skip pattern is "/api-docs.*|/swagger.*|.*\.png|.*\.css|.*\.js|.*\.html|/favicon.ico|/hystrix.stream"
2022-02-22T07:25:08,501 [main] INFO - HikariPool-1 - Starting...
2022-02-22T07:25:08,817 [main] INFO - HikariPool-1 - Start completed.
2022-02-22T07:25:08,895 [main] INFO - Flyway Community Edition 8.4.4 by Redgate
2022-02-22T07:25:08,896 [main] INFO - Database: jdbc:postgresql://connector-db:5432/connectordb (PostgreSQL 13.6)
2022-02-22T07:25:09,021 [main] INFO - Successfully validated 14 migrations (execution time 00:00.068s)
2022-02-22T07:25:09,100 [main] INFO - Creating Schema History table "public"."flyway_schema_history" ...
2022-02-22T07:25:09,356 [main] INFO - Current version of schema "public": << Empty Schema >>
2022-02-22T07:25:09,404 [main] INFO - Migrating schema "public" to version "5.0.0 - Baseline"
2022-02-22T07:25:09,440 [main] ERROR - Migration of schema "public" to version "5.0.0 - Baseline" failed! Changes successfully rolled back.
2022-02-22T07:25:09,499 [main] WARN - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V5.0.0__Baseline.sql failed\n-------------------------------------\nSQL State  : 42601\nError Code : 0\nMessage    : ERROR: syntax error at or near "CREATE"\n  Position: 303\nLocation   : db/migration/V5.0.0__Baseline.sql (/app/BOOT-INF/classes/db/migration/V5.0.0__Baseline.sql)\nLine       : 1\nStatement  : CREATE TABLE public.agreement (\n    id uuid NOT NULL,\n    created_date timestamp without time zone NOT NULL,\n    deleted boolean DEFAULT false,\n    modified_date timestamp without time zone NOT NULL,\n    archived boolean NOT NULL,\n    confirmed boolean NOT NULL,\n    remote_id bytea,\n    value text\n)\n\nCREATE TABLE public.agreement_additional (\n    agreement_id uuid NOT NULL,\n    additional character varying(255),\n    additional_key character varying(255) NOT NULL\n)\n\nCREATE TABLE public.agreement_artifacts (\n    agreements_id uuid NOT NULL,\n    artifacts_id uuid NOT NULL\n)\n\nCREATE TABLE public.artifact (\n    dtype character varying(31) NOT NULL,\n    id uuid NOT NULL,\n    created_date timestamp without time zone NOT NULL,\n    deleted boolean DEFAULT false,\n    modified_date timestamp without time zone NOT NULL,\n    automated_download boolean NOT NULL,\n    byte_size bigint NOT NULL,\n    check_sum bigint NOT NULL,\n    num_accessed bigint NOT NULL,\n    remote_address bytea,\n    remote_id bytea,\n    title character varying(255),\n    data_id bigint\n)\n\nCREATE TABLE public.artifact_additional (\n    artifact_id uuid NOT NULL,\n    additional character varying(255),\n    additional_key character varying(255) NOT NULL\n)\n\nCREATE TABLE public.catalog (\n    id uuid NOT NULL,\n    created_date timestamp without time zone NOT NULL,\n    deleted boolean DEFAULT false,\n    modified_date timestamp without time zone NOT NULL,\n    description character varying(255),\n    title character varying(255)\n)\n\nCREATE TABLE public.catalog_additional (\n    catalog_id uuid NOT NULL,\n    additional character varying(255),\n    additional_key character varying(255) NOT NULL\n)\n\nCREATE TABLE public.catalog_offered_resources (\n    catalogs_id uuid NOT NULL,\n    offered_resources_id uuid NOT NULL\n)\n\nCREATE TABLE public.catalog_requested_resources (\n    catalogs_id uuid NOT NULL,\n    requested_resources_id uuid NOT NULL\n)\n\nCREATE TABLE public.contract (\n    id uuid NOT NULL,\n    created_date timestamp without time zone NOT NULL,\n    deleted boolean DEFAULT false,\n    modified_date timestamp without time zone NOT NULL,\n    consumer bytea,\n    contract_end timestamp without time zone,\n    provider bytea,\n    remote_id bytea,\n    contract_start timestamp without time zone,\n    title character varying(255)\n)\n\nCREATE TABLE public.contract_additional (\n    contract_id uuid NOT NULL,\n    additional character varying(255),\n    additional_key character varying(255) NOT NULL\n)\n\nCREATE TABLE public.contract_rule_additional (\n    contract_rule_id uuid NOT NULL,\n    additional character varying(255),\n    additional_key character varying(255) NOT NULL\n)\n\nCREATE TABLE public.contract_rules (\n    contracts_id uuid NOT NULL,\n    rules_id uuid NOT NULL\n)\n\nCREATE TABLE public.contractrule (\n    id uuid NOT NULL,\n    created_date timestamp without time zone NOT NULL,\n    deleted boolean DEFAULT false,\n    modified_date timestamp without time zone NOT NULL,\n    remote_id bytea,\n    title character varying(255),\n    value text\n)\n\nCREATE TABLE public.data (\n    dtype character varying(31) NOT NULL,\n    id bigint NOT NULL,\n    deleted boolean DEFAULT false,\n    value oid,\n    access_url character varying(255),\n    password character varying(255),\n    username character varying(255)\n)\n\nCREATE SEQUENCE public.hibernate_sequence\n    START WITH 1\n    INCREMENT BY 1\n    NO MINVALUE\n    NO MAXVALUE\n    CACHE 1\n\n\n\nCREATE TABLE public.representation (\n    id uuid NOT NULL,\n    created_date timestamp without time zone NOT NULL,\n    deleted boolean DEFAULT false,\n    modified_date timestamp without time zone NOT NULL,\n    language character varying(255),\n    media_type character varying(255),\n    remote_id bytea,\n    standard character varying(255),\n    title character varying(255)\n)\n\nCREATE TABLE public.representation_additional (\n    representation_id uuid NOT NULL,\n    additional character varying(255),\n    additional_key character varying(255) NOT NULL\n)\n\nCREATE TABLE public.representation_artifacts (\n    representations_id uuid NOT NULL,\n    artifacts_id uuid NOT NULL\n)\n\nCREATE TABLE public.resource (\n    dtype character varying(31) NOT NULL,\n    id uuid NOT NULL,\n    created_date timestamp without time zone NOT NULL,\n    deleted boolean DEFAULT false,\n    modified_date timestamp without time zone NOT NULL,\n    description character varying(255),\n    endpoint_documentation bytea,\n    language character varying(255),\n    licence bytea,\n    publisher bytea,\n    sovereign bytea,\n    title character varying(255),\n    version bigint NOT NULL,\n    remote_id bytea\n)\n\nCREATE TABLE public.resource_additional (\n    resource_id uuid NOT NULL,\n    additional character varying(255),\n    additional_key character varying(255) NOT NULL\n)\n\nCREATE TABLE public.resource_contracts (\n    resources_id uuid NOT NULL,\n    contracts_id uuid NOT NULL\n)\n\nCREATE TABLE public.resource_keywords (\n    resource_id uuid NOT NULL,\n    keywords character varying(255)\n)\n\nCREATE TABLE public.resource_representations (\n    resources_id uuid NOT NULL,\n    representations_id uuid NOT NULL\n)\n\nALTER TABLE ONLY public.agreement_additional\n    ADD CONSTRAINT agreement_additional_pkey PRIMARY KEY (agreement_id, additional_key)\n\nALTER TABLE ONLY public.agreement\n    ADD CONSTRAINT agreement_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.artifact_additional\n    ADD CONSTRAINT artifact_additional_pkey PRIMARY KEY (artifact_id, additional_key)\n\nALTER TABLE ONLY public.artifact\n    ADD CONSTRAINT artifact_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.catalog_additional\n    ADD CONSTRAINT catalog_additional_pkey PRIMARY KEY (catalog_id, additional_key)\n\nALTER TABLE ONLY public.catalog\n    ADD CONSTRAINT catalog_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.contract_additional\n    ADD CONSTRAINT contract_additional_pkey PRIMARY KEY (contract_id, additional_key)\n\nALTER TABLE ONLY public.contract\n    ADD CONSTRAINT contract_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.contract_rule_additional\n    ADD CONSTRAINT contract_rule_additional_pkey PRIMARY KEY (contract_rule_id, additional_key)\n\nALTER TABLE ONLY public.contractrule\n    ADD CONSTRAINT contractrule_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.data\n    ADD CONSTRAINT data_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.representation_additional\n    ADD CONSTRAINT representation_additional_pkey PRIMARY KEY (representation_id, additional_key)\n\nALTER TABLE ONLY public.representation\n    ADD CONSTRAINT representation_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.resource_additional\n    ADD CONSTRAINT resource_additional_pkey PRIMARY KEY (resource_id, additional_key)\n\nALTER TABLE ONLY public.resource\n    ADD CONSTRAINT resource_pkey PRIMARY KEY (id)\n\nALTER TABLE ONLY public.artifact_additional\n    ADD CONSTRAINT fk39nygv2yn0osg687e1a42njrv FOREIGN KEY (artifact_id) REFERENCES public.artifact(id)\n\nALTER TABLE ONLY public.representation_artifacts\n    ADD CONSTRAINT fk4spj9uchowrwqldiua7xerffb FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)\n\nALTER TABLE ONLY public.resource_contracts\n    ADD CONSTRAINT fk5asnjcfur742nl713f8lcrbib FOREIGN KEY (contracts_id) REFERENCES public.contract(id)\n\nALTER TABLE ONLY public.agreement_artifacts\n    ADD CONSTRAINT fk7mjl82ejj66tmmrkspyoyailp FOREIGN KEY (agreements_id) REFERENCES public.agreement(id)\n\nALTER TABLE ONLY public.catalog_offered_resources\n    ADD CONSTRAINT fk98lr0lvbouf53nx6e2m51p36f FOREIGN KEY (catalogs_id) REFERENCES public.catalog(id)\n\nALTER TABLE ONLY public.contract_rules\n    ADD CONSTRAINT fka7kvb987lhl2yi5m2ayrgr6kk FOREIGN KEY (rules_id) REFERENCES public.contractrule(id)\n\nALTER TABLE ONLY public.catalog_offered_resources\n    ADD CONSTRAINT fkbisuxjltrepmrb0evdctb16xl FOREIGN KEY (offered_resources_id) REFERENCES public.resource(id)\n\nALTER TABLE ONLY public.contract_rules\n    ADD CONSTRAINT fkc13xssp8ajsjnxvrv6umejwt8 FOREIGN KEY (contracts_id) REFERENCES public.contract(id)\n\nALTER TABLE ONLY public.artifact\n    ADD CONSTRAINT fkcjyuh4gd12p2clxcdrywngnrk FOREIGN KEY (data_id) REFERENCES public.data(id)\n\nALTER TABLE ONLY public.representation_additional\n    ADD CONSTRAINT fkdcwg26vn7iksqwt3j0uv8bhsh FOREIGN KEY (representation_id) REFERENCES public.representation(id)\n\nALTER TABLE ONLY public.resource_representations\n    ADD CONSTRAINT fkdgkh2o4ihome47k0cv9ei28uw FOREIGN KEY (representations_id) REFERENCES public.representation(id)\n\nALTER TABLE ONLY public.catalog_additional\n    ADD CONSTRAINT fkf1tu8lci4kjy9b1mw5wnxht0g FOREIGN KEY (catalog_id) REFERENCES public.catalog(id)\n\nALTER TABLE ONLY public.agreement_additional\n    ADD CONSTRAINT fkfhfyofmftgys2ssia8n548xcl FOREIGN KEY (agreement_id) REFERENCES public.agreement(id)\n\nALTER TABLE ONLY public.contract_rule_additional\n    ADD CONSTRAINT fkh7xh0ik3ls87p4kvacl9q2med FOREIGN KEY (contract_rule_id) REFERENCES public.contractrule(id)\n\nALTER TABLE ONLY public.resource_additional\n    ADD CONSTRAINT fkii3qb000uovadjpmgnyk4i2oy FOREIGN KEY (resource_id) REFERENCES public.resource(id)\n\nALTER TABLE ONLY public.agreement_artifacts\n    ADD CONSTRAINT fkk81vbye4esds4rdyhna320vt7 FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)\n\nALTER TABLE ONLY public.resource_contracts\n    ADD CONSTRAINT fkll9wg6x5ir9vtnmat64d48icj FOREIGN KEY
2022-02-22T07:25:09,502 [main] INFO - HikariPool-1 - Shutdown initiated...
2022-02-22T07:25:09,507 [main] INFO - HikariPool-1 - Shutdown completed.
2022-02-22T07:25:09,518 [main] INFO - Stopping service [Tomcat]
2022-02-22T07:25:09,597 [main] INFO - \n\nError starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-02-22T07:25:09,631 [main] ERROR - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V5.0.0__Baseline.sql failed
-------------------------------------
SQL State  : 42601
Error Code : 0
Message    : ERROR: syntax error at or near "CREATE"
  Position: 303
Location   : db/migration/V5.0.0__Baseline.sql (/app/BOOT-INF/classes/db/migration/V5.0.0__Baseline.sql)
Line       : 1
Statement  : CREATE TABLE public.agreement (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    archived boolean NOT NULL,
    confirmed boolean NOT NULL,
    remote_id bytea,
    value text
)

CREATE TABLE public.agreement_additional (
    agreement_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.agreement_artifacts (
    agreements_id uuid NOT NULL,
    artifacts_id uuid NOT NULL
)

CREATE TABLE public.artifact (
    dtype character varying(31) NOT NULL,
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    automated_download boolean NOT NULL,
    byte_size bigint NOT NULL,
    check_sum bigint NOT NULL,
    num_accessed bigint NOT NULL,
    remote_address bytea,
    remote_id bytea,
    title character varying(255),
    data_id bigint
)

CREATE TABLE public.artifact_additional (
    artifact_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.catalog (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    description character varying(255),
    title character varying(255)
)

CREATE TABLE public.catalog_additional (
    catalog_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.catalog_offered_resources (
    catalogs_id uuid NOT NULL,
    offered_resources_id uuid NOT NULL
)

CREATE TABLE public.catalog_requested_resources (
    catalogs_id uuid NOT NULL,
    requested_resources_id uuid NOT NULL
)

CREATE TABLE public.contract (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    consumer bytea,
    contract_end timestamp without time zone,
    provider bytea,
    remote_id bytea,
    contract_start timestamp without time zone,
    title character varying(255)
)

CREATE TABLE public.contract_additional (
    contract_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.contract_rule_additional (
    contract_rule_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.contract_rules (
    contracts_id uuid NOT NULL,
    rules_id uuid NOT NULL
)

CREATE TABLE public.contractrule (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    remote_id bytea,
    title character varying(255),
    value text
)

CREATE TABLE public.data (
    dtype character varying(31) NOT NULL,
    id bigint NOT NULL,
    deleted boolean DEFAULT false,
    value oid,
    access_url character varying(255),
    password character varying(255),
    username character varying(255)
)

CREATE SEQUENCE public.hibernate_sequence
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1

CREATE TABLE public.representation (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    language character varying(255),
    media_type character varying(255),
    remote_id bytea,
    standard character varying(255),
    title character varying(255)
)

CREATE TABLE public.representation_additional (
    representation_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.representation_artifacts (
    representations_id uuid NOT NULL,
    artifacts_id uuid NOT NULL
)

CREATE TABLE public.resource (
    dtype character varying(31) NOT NULL,
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    description character varying(255),
    endpoint_documentation bytea,
    language character varying(255),
    licence bytea,
    publisher bytea,
    sovereign bytea,
    title character varying(255),
    version bigint NOT NULL,
    remote_id bytea
)

CREATE TABLE public.resource_additional (
    resource_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.resource_contracts (
    resources_id uuid NOT NULL,
    contracts_id uuid NOT NULL
)

CREATE TABLE public.resource_keywords (
    resource_id uuid NOT NULL,
    keywords character varying(255)
)

CREATE TABLE public.resource_representations (
    resources_id uuid NOT NULL,
    representations_id uuid NOT NULL
)

ALTER TABLE ONLY public.agreement_additional
    ADD CONSTRAINT agreement_additional_pkey PRIMARY KEY (agreement_id, additional_key)

ALTER TABLE ONLY public.agreement
    ADD CONSTRAINT agreement_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.artifact_additional
    ADD CONSTRAINT artifact_additional_pkey PRIMARY KEY (artifact_id, additional_key)

ALTER TABLE ONLY public.artifact
    ADD CONSTRAINT artifact_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.catalog_additional
    ADD CONSTRAINT catalog_additional_pkey PRIMARY KEY (catalog_id, additional_key)

ALTER TABLE ONLY public.catalog
    ADD CONSTRAINT catalog_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.contract_additional
    ADD CONSTRAINT contract_additional_pkey PRIMARY KEY (contract_id, additional_key)

ALTER TABLE ONLY public.contract
    ADD CONSTRAINT contract_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.contract_rule_additional
    ADD CONSTRAINT contract_rule_additional_pkey PRIMARY KEY (contract_rule_id, additional_key)

ALTER TABLE ONLY public.contractrule
    ADD CONSTRAINT contractrule_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.data
    ADD CONSTRAINT data_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.representation_additional
    ADD CONSTRAINT representation_additional_pkey PRIMARY KEY (representation_id, additional_key)

ALTER TABLE ONLY public.representation
    ADD CONSTRAINT representation_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.resource_additional
    ADD CONSTRAINT resource_additional_pkey PRIMARY KEY (resource_id, additional_key)

ALTER TABLE ONLY public.resource
    ADD CONSTRAINT resource_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.artifact_additional
    ADD CONSTRAINT fk39nygv2yn0osg687e1a42njrv FOREIGN KEY (artifact_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.representation_artifacts
    ADD CONSTRAINT fk4spj9uchowrwqldiua7xerffb FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.resource_contracts
    ADD CONSTRAINT fk5asnjcfur742nl713f8lcrbib FOREIGN KEY (contracts_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.agreement_artifacts
    ADD CONSTRAINT fk7mjl82ejj66tmmrkspyoyailp FOREIGN KEY (agreements_id) REFERENCES public.agreement(id)

ALTER TABLE ONLY public.catalog_offered_resources
    ADD CONSTRAINT fk98lr0lvbouf53nx6e2m51p36f FOREIGN KEY (catalogs_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.contract_rules
    ADD CONSTRAINT fka7kvb987lhl2yi5m2ayrgr6kk FOREIGN KEY (rules_id) REFERENCES public.contractrule(id)

ALTER TABLE ONLY public.catalog_offered_resources
    ADD CONSTRAINT fkbisuxjltrepmrb0evdctb16xl FOREIGN KEY (offered_resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.contract_rules
    ADD CONSTRAINT fkc13xssp8ajsjnxvrv6umejwt8 FOREIGN KEY (contracts_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.artifact
    ADD CONSTRAINT fkcjyuh4gd12p2clxcdrywngnrk FOREIGN KEY (data_id) REFERENCES public.data(id)

ALTER TABLE ONLY public.representation_additional
    ADD CONSTRAINT fkdcwg26vn7iksqwt3j0uv8bhsh FOREIGN KEY (representation_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.resource_representations
    ADD CONSTRAINT fkdgkh2o4ihome47k0cv9ei28uw FOREIGN KEY (representations_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.catalog_additional
    ADD CONSTRAINT fkf1tu8lci4kjy9b1mw5wnxht0g FOREIGN KEY (catalog_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.agreement_additional
    ADD CONSTRAINT fkfhfyofmftgys2ssia8n548xcl FOREIGN KEY (agreement_id) REFERENCES public.agreement(id)

ALTER TABLE ONLY public.contract_rule_additional
    ADD CONSTRAINT fkh7xh0ik3ls87p4kvacl9q2med FOREIGN KEY (contract_rule_id) REFERENCES public.contractrule(id)

ALTER TABLE ONLY public.resource_additional
    ADD CONSTRAINT fkii3qb000uovadjpmgnyk4i2oy FOREIGN KEY (resource_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.agreement_artifacts
    ADD CONSTRAINT fkk81vbye4esds4rdyhna320vt7 FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.resource_contracts
    ADD CONSTRAINT fkll9wg6x5ir9vtnmat64d48icj FOREIGN KEY (resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.resource_keywords
    ADD CONSTRAINT fklpel7ma6v39pj4t3e5igou7s8 FOREIGN KEY (resource_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.representation_artifacts
    ADD CONSTRAINT fkm2tgxey1y95fmavx8scq9ym8o FOREIGN KEY (representations_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.contract_additional
    ADD CONSTRAINT fkmvk084orjax8cjhy3fdh1ij1m FOREIGN KEY (contract_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.catalog_requested_resources
    ADD CONSTRAINT fksavyh2um62h3ueex93q8xf8xj FOREIGN KEY (catalogs_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.catalog_requested_resources
    ADD CONSTRAINT fksy60o45qscp2gylf33e21xyy8 FOREIGN KEY (requested_resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.resource_representations
    ADD CONSTRAINT fktntca482f3j16nwbrb9y6y51l FOREIGN KEY (resources_id) REFERENCES public.resource(id)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.15.jar:5.3.15]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.15.jar:5.3.15]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.15.jar:5.3.15]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.3.jar:2.6.3]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) [spring-boot-2.6.3.jar:2.6.3]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414) [spring-boot-2.6.3.jar:2.6.3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) [spring-boot-2.6.3.jar:2.6.3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.6.3.jar:2.6.3]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.6.3.jar:2.6.3]
        at io.dataspaceconnector.ConnectorApplication.main(ConnectorApplication.java:53) [classes/:7.0.2]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [app/:?]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [app/:?]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [app/:?]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [app/:?]
Caused by: org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V5.0.0__Baseline.sql failed
-------------------------------------
SQL State  : 42601
Error Code : 0
Message    : ERROR: syntax error at or near "CREATE"
  Position: 303
Location   : db/migration/V5.0.0__Baseline.sql (/app/BOOT-INF/classes/db/migration/V5.0.0__Baseline.sql)
Line       : 1
Statement  : CREATE TABLE public.agreement (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    archived boolean NOT NULL,
    confirmed boolean NOT NULL,
    remote_id bytea,
    value text
)

CREATE TABLE public.agreement_additional (
    agreement_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.agreement_artifacts (
    agreements_id uuid NOT NULL,
    artifacts_id uuid NOT NULL
)

CREATE TABLE public.artifact (
    dtype character varying(31) NOT NULL,
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    automated_download boolean NOT NULL,
    byte_size bigint NOT NULL,
    check_sum bigint NOT NULL,
    num_accessed bigint NOT NULL,
    remote_address bytea,
    remote_id bytea,
    title character varying(255),
    data_id bigint
)

CREATE TABLE public.artifact_additional (
    artifact_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.catalog (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    description character varying(255),
    title character varying(255)
)

CREATE TABLE public.catalog_additional (
    catalog_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.catalog_offered_resources (
    catalogs_id uuid NOT NULL,
    offered_resources_id uuid NOT NULL
)

CREATE TABLE public.catalog_requested_resources (
    catalogs_id uuid NOT NULL,
    requested_resources_id uuid NOT NULL
)

CREATE TABLE public.contract (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    consumer bytea,
    contract_end timestamp without time zone,
    provider bytea,
    remote_id bytea,
    contract_start timestamp without time zone,
    title character varying(255)
)

CREATE TABLE public.contract_additional (
    contract_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.contract_rule_additional (
    contract_rule_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.contract_rules (
    contracts_id uuid NOT NULL,
    rules_id uuid NOT NULL
)

CREATE TABLE public.contractrule (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    remote_id bytea,
    title character varying(255),
    value text
)

CREATE TABLE public.data (
    dtype character varying(31) NOT NULL,
    id bigint NOT NULL,
    deleted boolean DEFAULT false,
    value oid,
    access_url character varying(255),
    password character varying(255),
    username character varying(255)
)

CREATE SEQUENCE public.hibernate_sequence
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1

CREATE TABLE public.representation (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    language character varying(255),
    media_type character varying(255),
    remote_id bytea,
    standard character varying(255),
    title character varying(255)
)

CREATE TABLE public.representation_additional (
    representation_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.representation_artifacts (
    representations_id uuid NOT NULL,
    artifacts_id uuid NOT NULL
)

CREATE TABLE public.resource (
    dtype character varying(31) NOT NULL,
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    description character varying(255),
    endpoint_documentation bytea,
    language character varying(255),
    licence bytea,
    publisher bytea,
    sovereign bytea,
    title character varying(255),
    version bigint NOT NULL,
    remote_id bytea
)

CREATE TABLE public.resource_additional (
    resource_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.resource_contracts (
    resources_id uuid NOT NULL,
    contracts_id uuid NOT NULL
)

CREATE TABLE public.resource_keywords (
    resource_id uuid NOT NULL,
    keywords character varying(255)
)

CREATE TABLE public.resource_representations (
    resources_id uuid NOT NULL,
    representations_id uuid NOT NULL
)

ALTER TABLE ONLY public.agreement_additional
    ADD CONSTRAINT agreement_additional_pkey PRIMARY KEY (agreement_id, additional_key)

ALTER TABLE ONLY public.agreement
    ADD CONSTRAINT agreement_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.artifact_additional
    ADD CONSTRAINT artifact_additional_pkey PRIMARY KEY (artifact_id, additional_key)

ALTER TABLE ONLY public.artifact
    ADD CONSTRAINT artifact_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.catalog_additional
    ADD CONSTRAINT catalog_additional_pkey PRIMARY KEY (catalog_id, additional_key)

ALTER TABLE ONLY public.catalog
    ADD CONSTRAINT catalog_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.contract_additional
    ADD CONSTRAINT contract_additional_pkey PRIMARY KEY (contract_id, additional_key)

ALTER TABLE ONLY public.contract
    ADD CONSTRAINT contract_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.contract_rule_additional
    ADD CONSTRAINT contract_rule_additional_pkey PRIMARY KEY (contract_rule_id, additional_key)

ALTER TABLE ONLY public.contractrule
    ADD CONSTRAINT contractrule_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.data
    ADD CONSTRAINT data_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.representation_additional
    ADD CONSTRAINT representation_additional_pkey PRIMARY KEY (representation_id, additional_key)

ALTER TABLE ONLY public.representation
    ADD CONSTRAINT representation_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.resource_additional
    ADD CONSTRAINT resource_additional_pkey PRIMARY KEY (resource_id, additional_key)

ALTER TABLE ONLY public.resource
    ADD CONSTRAINT resource_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.artifact_additional
    ADD CONSTRAINT fk39nygv2yn0osg687e1a42njrv FOREIGN KEY (artifact_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.representation_artifacts
    ADD CONSTRAINT fk4spj9uchowrwqldiua7xerffb FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.resource_contracts
    ADD CONSTRAINT fk5asnjcfur742nl713f8lcrbib FOREIGN KEY (contracts_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.agreement_artifacts
    ADD CONSTRAINT fk7mjl82ejj66tmmrkspyoyailp FOREIGN KEY (agreements_id) REFERENCES public.agreement(id)

ALTER TABLE ONLY public.catalog_offered_resources
    ADD CONSTRAINT fk98lr0lvbouf53nx6e2m51p36f FOREIGN KEY (catalogs_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.contract_rules
    ADD CONSTRAINT fka7kvb987lhl2yi5m2ayrgr6kk FOREIGN KEY (rules_id) REFERENCES public.contractrule(id)

ALTER TABLE ONLY public.catalog_offered_resources
    ADD CONSTRAINT fkbisuxjltrepmrb0evdctb16xl FOREIGN KEY (offered_resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.contract_rules
    ADD CONSTRAINT fkc13xssp8ajsjnxvrv6umejwt8 FOREIGN KEY (contracts_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.artifact
    ADD CONSTRAINT fkcjyuh4gd12p2clxcdrywngnrk FOREIGN KEY (data_id) REFERENCES public.data(id)

ALTER TABLE ONLY public.representation_additional
    ADD CONSTRAINT fkdcwg26vn7iksqwt3j0uv8bhsh FOREIGN KEY (representation_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.resource_representations
    ADD CONSTRAINT fkdgkh2o4ihome47k0cv9ei28uw FOREIGN KEY (representations_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.catalog_additional
    ADD CONSTRAINT fkf1tu8lci4kjy9b1mw5wnxht0g FOREIGN KEY (catalog_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.agreement_additional
    ADD CONSTRAINT fkfhfyofmftgys2ssia8n548xcl FOREIGN KEY (agreement_id) REFERENCES public.agreement(id)

ALTER TABLE ONLY public.contract_rule_additional
    ADD CONSTRAINT fkh7xh0ik3ls87p4kvacl9q2med FOREIGN KEY (contract_rule_id) REFERENCES public.contractrule(id)

ALTER TABLE ONLY public.resource_additional
    ADD CONSTRAINT fkii3qb000uovadjpmgnyk4i2oy FOREIGN KEY (resource_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.agreement_artifacts
    ADD CONSTRAINT fkk81vbye4esds4rdyhna320vt7 FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.resource_contracts
    ADD CONSTRAINT fkll9wg6x5ir9vtnmat64d48icj FOREIGN KEY (resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.resource_keywords
    ADD CONSTRAINT fklpel7ma6v39pj4t3e5igou7s8 FOREIGN KEY (resource_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.representation_artifacts
    ADD CONSTRAINT fkm2tgxey1y95fmavx8scq9ym8o FOREIGN KEY (representations_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.contract_additional
    ADD CONSTRAINT fkmvk084orjax8cjhy3fdh1ij1m FOREIGN KEY (contract_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.catalog_requested_resources
    ADD CONSTRAINT fksavyh2um62h3ueex93q8xf8xj FOREIGN KEY (catalogs_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.catalog_requested_resources
    ADD CONSTRAINT fksy60o45qscp2gylf33e21xyy8 FOREIGN KEY (requested_resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.resource_representations
    ADD CONSTRAINT fktntca482f3j16nwbrb9y6y51l FOREIGN KEY (resources_id) REFERENCES public.resource(id)

        at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:385) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:275) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:274) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:247) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:141) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLAdvisoryLockTemplate.execute(PostgreSQLAdvisoryLockTemplate.java:69) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.lock(PostgreSQLConnection.java:99) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:139) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:141) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:98) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:173) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:124) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:214) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway.migrate(Flyway.java:124) ~[flyway-core-8.4.4.jar:?]
        at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-2.6.3.jar:2.6.3]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.15.jar:5.3.15]
        ... 26 more
Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Migration V5.0.0__Baseline.sql failed
-------------------------------------
SQL State  : 42601
Error Code : 0
Message    : ERROR: syntax error at or near "CREATE"
  Position: 303
Location   : db/migration/V5.0.0__Baseline.sql (/app/BOOT-INF/classes/db/migration/V5.0.0__Baseline.sql)
Line       : 1
Statement  : CREATE TABLE public.agreement (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    archived boolean NOT NULL,
    confirmed boolean NOT NULL,
    remote_id bytea,
    value text
)

CREATE TABLE public.agreement_additional (
    agreement_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.agreement_artifacts (
    agreements_id uuid NOT NULL,
    artifacts_id uuid NOT NULL
)

CREATE TABLE public.artifact (
    dtype character varying(31) NOT NULL,
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    automated_download boolean NOT NULL,
    byte_size bigint NOT NULL,
    check_sum bigint NOT NULL,
    num_accessed bigint NOT NULL,
    remote_address bytea,
    remote_id bytea,
    title character varying(255),
    data_id bigint
)

CREATE TABLE public.artifact_additional (
    artifact_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.catalog (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    description character varying(255),
    title character varying(255)
)

CREATE TABLE public.catalog_additional (
    catalog_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.catalog_offered_resources (
    catalogs_id uuid NOT NULL,
    offered_resources_id uuid NOT NULL
)

CREATE TABLE public.catalog_requested_resources (
    catalogs_id uuid NOT NULL,
    requested_resources_id uuid NOT NULL
)

CREATE TABLE public.contract (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    consumer bytea,
    contract_end timestamp without time zone,
    provider bytea,
    remote_id bytea,
    contract_start timestamp without time zone,
    title character varying(255)
)

CREATE TABLE public.contract_additional (
    contract_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.contract_rule_additional (
    contract_rule_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.contract_rules (
    contracts_id uuid NOT NULL,
    rules_id uuid NOT NULL
)

CREATE TABLE public.contractrule (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    remote_id bytea,
    title character varying(255),
    value text
)

CREATE TABLE public.data (
    dtype character varying(31) NOT NULL,
    id bigint NOT NULL,
    deleted boolean DEFAULT false,
    value oid,
    access_url character varying(255),
    password character varying(255),
    username character varying(255)
)

CREATE SEQUENCE public.hibernate_sequence
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1

CREATE TABLE public.representation (
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    language character varying(255),
    media_type character varying(255),
    remote_id bytea,
    standard character varying(255),
    title character varying(255)
)

CREATE TABLE public.representation_additional (
    representation_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.representation_artifacts (
    representations_id uuid NOT NULL,
    artifacts_id uuid NOT NULL
)

CREATE TABLE public.resource (
    dtype character varying(31) NOT NULL,
    id uuid NOT NULL,
    created_date timestamp without time zone NOT NULL,
    deleted boolean DEFAULT false,
    modified_date timestamp without time zone NOT NULL,
    description character varying(255),
    endpoint_documentation bytea,
    language character varying(255),
    licence bytea,
    publisher bytea,
    sovereign bytea,
    title character varying(255),
    version bigint NOT NULL,
    remote_id bytea
)

CREATE TABLE public.resource_additional (
    resource_id uuid NOT NULL,
    additional character varying(255),
    additional_key character varying(255) NOT NULL
)

CREATE TABLE public.resource_contracts (
    resources_id uuid NOT NULL,
    contracts_id uuid NOT NULL
)

CREATE TABLE public.resource_keywords (
    resource_id uuid NOT NULL,
    keywords character varying(255)
)

CREATE TABLE public.resource_representations (
    resources_id uuid NOT NULL,
    representations_id uuid NOT NULL
)

ALTER TABLE ONLY public.agreement_additional
    ADD CONSTRAINT agreement_additional_pkey PRIMARY KEY (agreement_id, additional_key)

ALTER TABLE ONLY public.agreement
    ADD CONSTRAINT agreement_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.artifact_additional
    ADD CONSTRAINT artifact_additional_pkey PRIMARY KEY (artifact_id, additional_key)

ALTER TABLE ONLY public.artifact
    ADD CONSTRAINT artifact_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.catalog_additional
    ADD CONSTRAINT catalog_additional_pkey PRIMARY KEY (catalog_id, additional_key)

ALTER TABLE ONLY public.catalog
    ADD CONSTRAINT catalog_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.contract_additional
    ADD CONSTRAINT contract_additional_pkey PRIMARY KEY (contract_id, additional_key)

ALTER TABLE ONLY public.contract
    ADD CONSTRAINT contract_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.contract_rule_additional
    ADD CONSTRAINT contract_rule_additional_pkey PRIMARY KEY (contract_rule_id, additional_key)

ALTER TABLE ONLY public.contractrule
    ADD CONSTRAINT contractrule_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.data
    ADD CONSTRAINT data_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.representation_additional
    ADD CONSTRAINT representation_additional_pkey PRIMARY KEY (representation_id, additional_key)

ALTER TABLE ONLY public.representation
    ADD CONSTRAINT representation_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.resource_additional
    ADD CONSTRAINT resource_additional_pkey PRIMARY KEY (resource_id, additional_key)

ALTER TABLE ONLY public.resource
    ADD CONSTRAINT resource_pkey PRIMARY KEY (id)

ALTER TABLE ONLY public.artifact_additional
    ADD CONSTRAINT fk39nygv2yn0osg687e1a42njrv FOREIGN KEY (artifact_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.representation_artifacts
    ADD CONSTRAINT fk4spj9uchowrwqldiua7xerffb FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.resource_contracts
    ADD CONSTRAINT fk5asnjcfur742nl713f8lcrbib FOREIGN KEY (contracts_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.agreement_artifacts
    ADD CONSTRAINT fk7mjl82ejj66tmmrkspyoyailp FOREIGN KEY (agreements_id) REFERENCES public.agreement(id)

ALTER TABLE ONLY public.catalog_offered_resources
    ADD CONSTRAINT fk98lr0lvbouf53nx6e2m51p36f FOREIGN KEY (catalogs_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.contract_rules
    ADD CONSTRAINT fka7kvb987lhl2yi5m2ayrgr6kk FOREIGN KEY (rules_id) REFERENCES public.contractrule(id)

ALTER TABLE ONLY public.catalog_offered_resources
    ADD CONSTRAINT fkbisuxjltrepmrb0evdctb16xl FOREIGN KEY (offered_resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.contract_rules
    ADD CONSTRAINT fkc13xssp8ajsjnxvrv6umejwt8 FOREIGN KEY (contracts_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.artifact
    ADD CONSTRAINT fkcjyuh4gd12p2clxcdrywngnrk FOREIGN KEY (data_id) REFERENCES public.data(id)

ALTER TABLE ONLY public.representation_additional
    ADD CONSTRAINT fkdcwg26vn7iksqwt3j0uv8bhsh FOREIGN KEY (representation_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.resource_representations
    ADD CONSTRAINT fkdgkh2o4ihome47k0cv9ei28uw FOREIGN KEY (representations_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.catalog_additional
    ADD CONSTRAINT fkf1tu8lci4kjy9b1mw5wnxht0g FOREIGN KEY (catalog_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.agreement_additional
    ADD CONSTRAINT fkfhfyofmftgys2ssia8n548xcl FOREIGN KEY (agreement_id) REFERENCES public.agreement(id)

ALTER TABLE ONLY public.contract_rule_additional
    ADD CONSTRAINT fkh7xh0ik3ls87p4kvacl9q2med FOREIGN KEY (contract_rule_id) REFERENCES public.contractrule(id)

ALTER TABLE ONLY public.resource_additional
    ADD CONSTRAINT fkii3qb000uovadjpmgnyk4i2oy FOREIGN KEY (resource_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.agreement_artifacts
    ADD CONSTRAINT fkk81vbye4esds4rdyhna320vt7 FOREIGN KEY (artifacts_id) REFERENCES public.artifact(id)

ALTER TABLE ONLY public.resource_contracts
    ADD CONSTRAINT fkll9wg6x5ir9vtnmat64d48icj FOREIGN KEY (resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.resource_keywords
    ADD CONSTRAINT fklpel7ma6v39pj4t3e5igou7s8 FOREIGN KEY (resource_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.representation_artifacts
    ADD CONSTRAINT fkm2tgxey1y95fmavx8scq9ym8o FOREIGN KEY (representations_id) REFERENCES public.representation(id)

ALTER TABLE ONLY public.contract_additional
    ADD CONSTRAINT fkmvk084orjax8cjhy3fdh1ij1m FOREIGN KEY (contract_id) REFERENCES public.contract(id)

ALTER TABLE ONLY public.catalog_requested_resources
    ADD CONSTRAINT fksavyh2um62h3ueex93q8xf8xj FOREIGN KEY (catalogs_id) REFERENCES public.catalog(id)

ALTER TABLE ONLY public.catalog_requested_resources
    ADD CONSTRAINT fksy60o45qscp2gylf33e21xyy8 FOREIGN KEY (requested_resources_id) REFERENCES public.resource(id)

ALTER TABLE ONLY public.resource_representations
    ADD CONSTRAINT fktntca482f3j16nwbrb9y6y51l FOREIGN KEY (resources_id) REFERENCES public.resource(id)

        at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:275) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:222) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:126) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:69) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:58) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:57) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:377) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:275) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:274) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:247) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:141) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLAdvisoryLockTemplate.execute(PostgreSQLAdvisoryLockTemplate.java:69) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.lock(PostgreSQLConnection.java:99) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:139) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:141) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:98) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:173) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:124) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:214) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway.migrate(Flyway.java:124) ~[flyway-core-8.4.4.jar:?]
        at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-2.6.3.jar:2.6.3]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.15.jar:5.3.15]
        ... 26 more
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "CREATE"
  Position: 303
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:329) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:315) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:291) ~[postgresql-42.3.3.jar:42.3.3]
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:286) ~[postgresql-42.3.3.jar:42.3.3]
        at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94) ~[HikariCP-4.0.3.jar:?]
        at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-4.0.3.jar:?]
        at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:201) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:95) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:210) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:126) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:69) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:58) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:57) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:377) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:275) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:274) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:247) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:141) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLAdvisoryLockTemplate.execute(PostgreSQLAdvisoryLockTemplate.java:69) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.lock(PostgreSQLConnection.java:99) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:139) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:141) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:98) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:173) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:124) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:214) ~[flyway-core-8.4.4.jar:?]
        at org.flywaydb.core.Flyway.migrate(Flyway.java:124) ~[flyway-core-8.4.4.jar:?]
        at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-2.6.3.jar:2.6.3]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.15.jar:5.3.15]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.15.jar:5.3.15]
        ... 26 more
SebastianOpriel commented 2 years ago

@phertweck I could reproduce the error. I fixed the sql file in PR https://github.com/International-Data-Spaces-Association/DataspaceConnector/pull/923

phertweck commented 2 years ago

@SebastianOpriel Thanks! I'm waiting for the PR to be merged, then I'll check on our side.