fix(distro-ddl): fix `bytea` vs `oid` on Postgres for outbox DDL. Try to keep compatibility.
For some reason the outbox table had BINARY type instead of JSON (probably didn't change it after
going from JSONB to JSON?).
MODIFY
distro/data/src/main/resources/ddls/apiman_h2.ddl
distro/data/src/main/resources/ddls/apiman_h2.ddl
@@ -348,7 +348,7 @@ CREATE TABLE api_tag (api_id VARCHAR(255) NOT NULL, org_id VARCHAR(255) NOT NULL
CREATE TABLE blob_store (id VARCHAR(255) NOT NULL, mrblobby BLOB NOT NULL, created_on TIMESTAMP NOT NULL, hash BIGINT NOT NULL, mime_type VARCHAR(255) NOT NULL, modified_on TIMESTAMP NOT NULL, name VARCHAR(255) NOT NULL, ref_count INT NOT NULL, CONSTRAINT blob_storePK PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-7::msavy (generated)
-CREATE TABLE outbox (id BIGINT AUTO_INCREMENT NOT NULL, event_version BIGINT NOT NULL, payload BINARY NOT NULL, source VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, time TIMESTAMP NOT NULL, type VARCHAR(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id));
+CREATE TABLE outbox (id BIGINT AUTO_INCREMENT NOT NULL, event_version BIGINT NOT NULL, payload JSON NOT NULL, source VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, time TIMESTAMP NOT NULL, type VARCHAR(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-8::msavy (generated)
ALTER TABLE blob_store ADD CONSTRAINT UC_BLOB_STOREID_COL UNIQUE (id);

MODIFY
distro/data/src/main/resources/ddls/apiman_mssql15.ddl
distro/data/src/main/resources/ddls/apiman_mssql15.ddl
@@ -455,7 +455,7 @@ CREATE TABLE blob_store (id varchar(255) NOT NULL, mrblobby varbinary(MAX) NOT N
GO
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-7::msavy (generated)
-CREATE TABLE outbox (id bigint IDENTITY (1, 1) NOT NULL, event_version bigint NOT NULL, payload binary(1) NOT NULL, source varchar(255) NOT NULL, subject varchar(255) NOT NULL, time datetime NOT NULL, type varchar(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id))
+CREATE TABLE outbox (id bigint IDENTITY (1, 1) NOT NULL, event_version bigint NOT NULL, payload JSON NOT NULL, source varchar(255) NOT NULL, subject varchar(255) NOT NULL, time datetime NOT NULL, type varchar(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id))
GO
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-8::msavy (generated)

MODIFY
distro/data/src/main/resources/ddls/apiman_mysql8.ddl
distro/data/src/main/resources/ddls/apiman_mysql8.ddl
@@ -346,7 +346,7 @@ CREATE TABLE api_tag (api_id VARCHAR(255) NOT NULL, org_id VARCHAR(255) NOT NULL
CREATE TABLE blob_store (id VARCHAR(255) NOT NULL, mrblobby BLOB NOT NULL, created_on timestamp NOT NULL, hash BIGINT NOT NULL, mime_type VARCHAR(255) NOT NULL, modified_on timestamp NOT NULL, name VARCHAR(255) NOT NULL, ref_count INT NOT NULL, CONSTRAINT blob_storePK PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-7::msavy (generated)
-CREATE TABLE outbox (id BIGINT AUTO_INCREMENT NOT NULL, event_version BIGINT NOT NULL, payload BINARY NOT NULL, source VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, time timestamp NOT NULL, type VARCHAR(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id));
+CREATE TABLE outbox (id BIGINT AUTO_INCREMENT NOT NULL, event_version BIGINT NOT NULL, payload JSON NOT NULL, source VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, time timestamp NOT NULL, type VARCHAR(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-8::msavy (generated)
ALTER TABLE blob_store ADD CONSTRAINT UC_BLOB_STOREID_COL UNIQUE (id);

MODIFY
distro/data/src/main/resources/ddls/apiman_oracle19.ddl
distro/data/src/main/resources/ddls/apiman_oracle19.ddl
@@ -341,7 +341,7 @@ CREATE TABLE api_tag (api_id VARCHAR2(255) NOT NULL, org_id VARCHAR2(255) NOT NU
CREATE TABLE blob_store (id VARCHAR2(255) NOT NULL, mrblobby BLOB NOT NULL, created_on TIMESTAMP NOT NULL, hash NUMBER(38, 0) NOT NULL, mime_type VARCHAR2(255) NOT NULL, modified_on TIMESTAMP NOT NULL, name VARCHAR2(255) NOT NULL, ref_count INTEGER NOT NULL, CONSTRAINT blob_storePK PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-7::msavy (generated)
-CREATE TABLE outbox (id NUMBER(38, 0) GENERATED BY DEFAULT AS IDENTITY NOT NULL, event_version NUMBER(38, 0) NOT NULL, payload RAW NOT NULL, source VARCHAR2(255) NOT NULL, subject VARCHAR2(255) NOT NULL, time TIMESTAMP NOT NULL, type VARCHAR2(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id));
+CREATE TABLE outbox (id NUMBER(38, 0) GENERATED BY DEFAULT AS IDENTITY NOT NULL, event_version NUMBER(38, 0) NOT NULL, payload JSON NOT NULL, source VARCHAR2(255) NOT NULL, subject VARCHAR2(255) NOT NULL, time TIMESTAMP NOT NULL, type VARCHAR2(255) NOT NULL, CONSTRAINT outboxPK PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-8::msavy (generated)
ALTER TABLE blob_store ADD CONSTRAINT UC_BLOB_STOREID_COL UNIQUE (id);

MODIFY
distro/data/src/main/resources/ddls/apiman_postgresql9.ddl
distro/data/src/main/resources/ddls/apiman_postgresql9.ddl
@@ -344,7 +344,7 @@ CREATE TABLE api_tag (api_id VARCHAR(255) NOT NULL, org_id VARCHAR(255) NOT NULL
CREATE TABLE blob_store (id VARCHAR(255) NOT NULL, mrblobby OID NOT NULL, created_on TIMESTAMP WITHOUT TIME ZONE NOT NULL, hash BIGINT NOT NULL, mime_type VARCHAR(255) NOT NULL, modified_on TIMESTAMP WITHOUT TIME ZONE NOT NULL, name VARCHAR(255) NOT NULL, ref_count INTEGER NOT NULL, CONSTRAINT "blob_storePK" PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-7::msavy (generated)
-CREATE TABLE outbox (id BIGSERIAL NOT NULL, event_version BIGINT NOT NULL, payload BYTEA NOT NULL, source VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, time TIMESTAMP WITHOUT TIME ZONE NOT NULL, type VARCHAR(255) NOT NULL, CONSTRAINT "outboxPK" PRIMARY KEY (id));
+CREATE TABLE outbox (id BIGSERIAL NOT NULL, event_version BIGINT NOT NULL, payload JSON NOT NULL, source VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, time TIMESTAMP WITHOUT TIME ZONE NOT NULL, type VARCHAR(255) NOT NULL, CONSTRAINT "outboxPK" PRIMARY KEY (id));
-- Changeset src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml::1633542267834-8::msavy (generated)
ALTER TABLE blob_store ADD CONSTRAINT UC_BLOB_STOREID_COL UNIQUE (id);

MODIFY
distro/ddl/src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml
distro/ddl/src/main/liquibase/current/20211002-154432-apiman3-dev-portal-2-initial.changelog.xml
<column name="event_version" type="BIGINT">
<constraints nullable="false"/>
</column>
- <column name="payload" type="BINARY">
+ <column name="payload" type="JSON">
<constraints nullable="false"/>
</column>
<column name="source" type="VARCHAR(255)">

MODIFY
manager/api/beans/src/main/java/io/apiman/manager/api/beans/apis/ApiDefinitionBean.java
manager/api/beans/src/main/java/io/apiman/manager/api/beans/apis/ApiDefinitionBean.java
@@ -17,16 +17,17 @@ package io.apiman.manager.api.beans.apis;
import java.io.Serializable;
import java.util.Arrays;
+import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import org.hibernate.annotations.Type;
/**
* Bean used to store an API definition.
@@ -45,7 +46,8 @@ public class ApiDefinitionBean implements Serializable {
@OneToOne(fetch=FetchType.LAZY)
@JoinColumn(name="api_version_id")
private ApiVersionBean apiVersion;
- @Lob
+
+ @Column(name = "data")
private byte[] data;
/**

MODIFY
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/ApimanPostgreSQLDialect.java
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/ApimanPostgreSQLDialect.java
*/
package io.apiman.manager.api.jpa;
+import java.sql.Types;
+
import org.hibernate.dialect.PostgreSQL95Dialect;
/**
@@ -29,6 +31,6 @@ public class ApimanPostgreSQLDialect extends PostgreSQL95Dialect {
* Constructor.
*/
public ApimanPostgreSQLDialect() {
+ super();
}
-
}

fix(distro-ddl): fix `bytea` vs `oid` on Postgres for outbox DDL. Try to keep compatibility.

For some reason the outbox table had BINARY type instead of JSON (probably didn't change it after
going from JSONB to JSON?).