bf2343b7e4
Integration Tests - MySQL + Elasticsearch / Detect Changes (push) Has been cancelled
Integration Tests - MySQL + Elasticsearch / integration-tests-mysql-elasticsearch (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / integration-tests-postgres-elasticsearch-redis (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / integration-tests-postgres-opensearch (push) Has been cancelled
Java Checkstyle / java-checkstyle (push) Has been cancelled
Maven Collate Tests / maven-collate-ci (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests-status (push) Has been cancelled
Publish Package to Maven Central Repository / publish-maven-packages (push) Has been cancelled
OpenMetadata Service Unit Tests / Detect Changes (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests (push) Has been cancelled
OpenMetadata Service Unit Tests / k8s_operator-unit-tests (push) Has been cancelled
41 lines
2.6 KiB
SQL
41 lines
2.6 KiB
SQL
-- IntakeForm entity table: per-entity-type governance-required-field configuration
|
|
CREATE TABLE IF NOT EXISTS intake_form_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(256) NOT NULL,
|
|
entityType VARCHAR(64) GENERATED ALWAYS AS ((json ->> 'entityType')) STORED 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,
|
|
PRIMARY KEY (id),
|
|
UNIQUE (fqnHash),
|
|
UNIQUE (entityType)
|
|
);
|
|
|
|
-- ---------------------------------------------------------------------------
|
|
-- Backfill the per-entity `name` index on entity tables that were created
|
|
-- without one. The distributed reindex paginates every entity type with
|
|
-- `... ORDER BY name, id LIMIT 1 OFFSET :n` (EntityRepository.getCursorAtOffset).
|
|
-- Without a `name`-leading index that ORDER BY is a sort that can exhaust
|
|
-- work_mem on large tables; `<table>_name_index(name)` lets the cursor query run
|
|
-- index-only instead. Idempotent via IF NOT EXISTS. Covers only entity tables
|
|
-- that exist as of 1.13.1; later tables get the index in their own migration.
|
|
-- ---------------------------------------------------------------------------
|
|
CREATE INDEX IF NOT EXISTS directory_entity_name_index ON directory_entity (name);
|
|
CREATE INDEX IF NOT EXISTS drive_service_entity_name_index ON drive_service_entity (name);
|
|
CREATE INDEX IF NOT EXISTS file_entity_name_index ON file_entity (name);
|
|
CREATE INDEX IF NOT EXISTS spreadsheet_entity_name_index ON spreadsheet_entity (name);
|
|
CREATE INDEX IF NOT EXISTS worksheet_entity_name_index ON worksheet_entity (name);
|
|
-- learning_resource_entity is intentionally omitted: its `name` is varchar(3072), too
|
|
-- wide to fit a btree index row, and the table is small enough that the reindex cursor
|
|
-- sort is not a concern.
|
|
|
|
-- Additional pre-1.13.1 entity tables the block above missed. On Postgres only the api_*
|
|
-- tables lacked a leading-`name` index (they had only a `(deleted, name, id)` composite); the
|
|
-- other reindexed tables of this era already have `idx_name_*`. security_service_entity is
|
|
-- omitted: it already has a `UNIQUE (name)` constraint that orders by name.
|
|
CREATE INDEX IF NOT EXISTS api_collection_entity_name_index ON api_collection_entity (name);
|
|
CREATE INDEX IF NOT EXISTS api_endpoint_entity_name_index ON api_endpoint_entity (name);
|
|
CREATE INDEX IF NOT EXISTS api_service_entity_name_index ON api_service_entity (name);
|