Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ exports[`db_meta_modules should verify module table structures have database_id

exports[`db_meta_modules should verify module tables have proper foreign key relationships 1`] = `
{
"constraintCount": 100951,
"constraintCount": 104821,
"foreignTables": [
"apis",
"database",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
-- Deploy schemas/metaschema_public/tables/enum/table to pg

-- requires: schemas/metaschema_public/schema
-- requires: schemas/metaschema_public/tables/database/table
-- requires: schemas/metaschema_public/tables/schema/table
-- requires: schemas/metaschema_public/types/object_category

BEGIN;

CREATE TABLE metaschema_public.enum (
id uuid PRIMARY KEY DEFAULT uuid_generate_v4 (),
database_id uuid NOT NULL,
schema_id uuid NOT NULL,
name text NOT NULL,

label text,
description text,

values text[] NOT NULL DEFAULT '{}',

smart_tags jsonb,

category metaschema_public.object_category NOT NULL DEFAULT 'app',
module text NULL,
scope int NULL,

tags citext[] NOT NULL DEFAULT '{}',

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT schema_fkey FOREIGN KEY (schema_id) REFERENCES metaschema_public.schema (id) ON DELETE CASCADE,

UNIQUE (schema_id, name)
);

COMMENT ON CONSTRAINT db_fkey ON metaschema_public.enum IS E'@omit manyToMany';
COMMENT ON CONSTRAINT schema_fkey ON metaschema_public.enum IS E'@omit manyToMany';

CREATE INDEX enum_schema_id_idx ON metaschema_public.enum ( schema_id );
CREATE INDEX enum_database_id_idx ON metaschema_public.enum ( database_id );

COMMIT;
1 change: 1 addition & 0 deletions packages/metaschema-schema/pgpm.plan
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ schemas/metaschema_public/tables/view_table/table [schemas/metaschema_public/sch
schemas/metaschema_public/tables/view_grant/table [schemas/metaschema_public/schema schemas/metaschema_public/tables/view/table schemas/metaschema_public/tables/database/table] 2026-01-23T00:00:00Z devin <devin@cognition.ai> # add schemas/metaschema_public/tables/view_grant/table
schemas/metaschema_public/tables/view_rule/table [schemas/metaschema_public/schema schemas/metaschema_public/tables/view/table schemas/metaschema_public/tables/database/table] 2026-01-23T00:00:00Z devin <devin@cognition.ai> # add schemas/metaschema_public/tables/view_rule/table
schemas/metaschema_public/tables/default_privilege/table [schemas/metaschema_public/schema schemas/metaschema_public/tables/schema/table schemas/metaschema_public/tables/database/table] 2026-02-27T00:00:00Z Constructive <developers@constructive.io> # add schemas/metaschema_public/tables/default_privilege/table
schemas/metaschema_public/tables/enum/table [schemas/metaschema_public/schema schemas/metaschema_public/tables/database/table schemas/metaschema_public/tables/schema/table schemas/metaschema_public/types/object_category] 2026-03-15T00:00:00Z devin <devin@cognition.ai> # add schemas/metaschema_public/tables/enum/table
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Revert schemas/metaschema_public/tables/enum/table from pg

BEGIN;

DROP TABLE metaschema_public.enum;

COMMIT;
32 changes: 32 additions & 0 deletions packages/metaschema-schema/sql/metaschema-schema--0.15.5.sql
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,35 @@ COMMENT ON CONSTRAINT db_fkey ON metaschema_public.unique_constraint IS '@omit m
CREATE INDEX unique_constraint_table_id_idx ON metaschema_public.unique_constraint (table_id);

CREATE INDEX unique_constraint_database_id_idx ON metaschema_public.unique_constraint (database_id);

CREATE TABLE metaschema_public.enum (
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
database_id uuid NOT NULL,
schema_id uuid NOT NULL,
name text NOT NULL,
label text,
description text,
values text[] NOT NULL DEFAULT '{}',
smart_tags jsonb,
category metaschema_public.object_category NOT NULL DEFAULT 'app',
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
ON DELETE CASCADE,
CONSTRAINT schema_fkey
FOREIGN KEY(schema_id)
REFERENCES metaschema_public.schema (id)
ON DELETE CASCADE,
UNIQUE (schema_id, name)
);

COMMENT ON CONSTRAINT db_fkey ON metaschema_public.enum IS '@omit manyToMany';

COMMENT ON CONSTRAINT schema_fkey ON metaschema_public.enum IS '@omit manyToMany';

CREATE INDEX enum_schema_id_idx ON metaschema_public.enum (schema_id);

CREATE INDEX enum_database_id_idx ON metaschema_public.enum (database_id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Verify schemas/metaschema_public/tables/enum/table on pg

BEGIN;

SELECT verify_table ('metaschema_public.enum');

ROLLBACK;
Loading