Sriharsha Chintalapani 18bd4689a0
Add Data Contracts Specification and APIs (#21164)
* Add Data Contracts Specification and APIs

* Fix checkstyle

* Add @Repository

* Add @Repository

* Address YAML APIs

* Fix tests

* Fix tests

* Address comments

* Fix tests for checking table/topic fields do exists for a data contract

* migrate to jakarta

* migrate to jakarta

* add semantics

---------

Co-authored-by: Harsha <harsha@Harshas-MacBook-Air.local>
Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com>
2025-06-04 06:36:28 +02:00

21 lines
923 B
SQL

ALTER TABLE background_jobs
ADD COLUMN runAt BIGINT;
CREATE INDEX background_jobs_run_at_index ON background_jobs(runAt);
-- Create data contract table
CREATE TABLE IF NOT EXISTS data_contract_entity (
id VARCHAR(36) GENERATED ALWAYS AS (json ->> 'id') STORED NOT NULL,
name VARCHAR(256) GENERATED ALWAYS AS (json ->> 'name') STORED NOT NULL,
fqnHash VARCHAR(768) NOT NULL,
json JSONB NOT NULL,
updatedAt BIGINT GENERATED ALWAYS AS ((json ->> 'updatedAt')::bigint) STORED NOT NULL,
updatedBy VARCHAR(256) GENERATED ALWAYS AS (json ->> 'updatedBy') STORED NOT NULL,
deleted BOOLEAN GENERATED ALWAYS AS ((json ->> 'deleted')::boolean) STORED NOT NULL,
PRIMARY KEY (id),
UNIQUE (fqnHash)
);
-- Create indexes
CREATE INDEX IF NOT EXISTS data_contract_entity_name_index ON data_contract_entity (name);
CREATE INDEX IF NOT EXISTS index_data_contract_entity_deleted ON data_contract_entity (fqnHash, deleted);