Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/metaschema-schema/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION = metaschema-schema
DATA = sql/metaschema-schema--0.26.1.sql
DATA = sql/metaschema-schema--0.26.3.sql

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ CREATE TABLE metaschema_public.check_constraint (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ CREATE TABLE metaschema_public.database (
label text,

hash uuid,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

unique(schema_hash)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ CREATE TABLE metaschema_public.embedding_chunks (
-- FK field on chunks table pointing to parent
parent_fk_field_id uuid,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,
CONSTRAINT chunks_table_fkey FOREIGN KEY (chunks_table_id) REFERENCES metaschema_public.table (id) ON DELETE SET NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ CREATE TABLE metaschema_public.field (
module text NULL,
scope int NULL,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ CREATE TABLE metaschema_public.foreign_key_constraint (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ CREATE TABLE metaschema_public.full_text_search (
field_ids uuid[] NOT NULL,
weights text[] NOT NULL,
langs text[] NOT NULL,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

--

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ CREATE TABLE metaschema_public.index (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ CREATE TABLE metaschema_public.partition (
naming_pattern text NOT NULL DEFAULT '{parent}_{bounds}',
is_parented boolean NOT NULL DEFAULT false,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT partition_database_fkey
FOREIGN KEY (database_id)
REFERENCES metaschema_public.database (id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ CREATE TABLE metaschema_public.policy (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ CREATE TABLE metaschema_public.primary_key_constraint (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ CREATE TABLE metaschema_public.schema (

is_public boolean NOT NULL DEFAULT TRUE,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

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

UNIQUE (database_id, name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ CREATE TABLE metaschema_public.schema_grant (

schema_id uuid NOT NULL,
grantee_name text NOT NULL,
--

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

--
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ CREATE TABLE metaschema_public.spatial_relation (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,
CONSTRAINT field_fkey FOREIGN KEY (field_id) REFERENCES metaschema_public.field (id) ON DELETE CASCADE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ CREATE TABLE metaschema_public.table (
partition_key_names text[] DEFAULT NULL,
partition_key_types text[] DEFAULT NULL,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

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,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ CREATE TABLE metaschema_public.table_grant (
-- true = GRANT, false = REVOKE
is_grant boolean NOT NULL DEFAULT true,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

--
CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ CREATE TABLE metaschema_public.trigger (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ CREATE TABLE metaschema_public.trigger_function (
name text NOT NULL,
code text,

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

--
CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
UNIQUE (database_id, name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ CREATE TABLE metaschema_public.unique_constraint (

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

created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),

CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
CONSTRAINT table_fkey FOREIGN KEY (table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE,

Expand Down
2 changes: 1 addition & 1 deletion packages/metaschema-schema/metaschema-schema.control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# metaschema-schema extension
comment = 'metaschema-schema extension'
default_version = '0.26.1'
default_version = '0.26.3'
module_pathname = '$libdir/metaschema-schema'
requires = 'citext,hstore,pgpm-inflection,pgpm-database-jobs,pgpm-types,pgcrypto,plpgsql,postgis,uuid-ossp,pgpm-verify'
relocatable = false
Expand Down
2 changes: 1 addition & 1 deletion packages/metaschema-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
"bugs": {
"url": "https://github.com/constructive-io/pgpm-modules/issues"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ CREATE TABLE metaschema_public.database (
name text,
label text,
hash uuid,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
UNIQUE (schema_hash)
);

Expand All @@ -56,6 +58,8 @@ CREATE TABLE metaschema_public.schema (
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
is_public boolean NOT NULL DEFAULT true,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -91,6 +95,8 @@ CREATE TABLE metaschema_public."table" (
partition_strategy text DEFAULT NULL,
partition_key_names text[] DEFAULT NULL,
partition_key_types text[] DEFAULT NULL,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -124,6 +130,8 @@ CREATE TABLE metaschema_public.check_constraint (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -170,6 +178,8 @@ CREATE TABLE metaschema_public.field (
category metaschema_public.object_category NOT NULL DEFAULT 'app',
module text NULL,
scope int NULL,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -210,6 +220,8 @@ CREATE TABLE metaschema_public.foreign_key_constraint (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand All @@ -235,6 +247,8 @@ CREATE TABLE metaschema_public.full_text_search (
field_ids uuid[] NOT NULL,
weights text[] NOT NULL,
langs text[] NOT NULL,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -271,6 +285,8 @@ CREATE TABLE metaschema_public.index (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -302,6 +318,8 @@ CREATE TABLE metaschema_public.policy (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -329,6 +347,8 @@ CREATE TABLE metaschema_public.primary_key_constraint (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand All @@ -350,6 +370,8 @@ CREATE TABLE metaschema_public.schema_grant (
database_id uuid NOT NULL DEFAULT uuid_nil(),
schema_id uuid NOT NULL,
grantee_name text NOT NULL,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand All @@ -372,6 +394,8 @@ CREATE TABLE metaschema_public.table_grant (
grantee_name text NOT NULL,
field_ids uuid[],
is_grant boolean NOT NULL DEFAULT true,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -400,6 +424,8 @@ CREATE TABLE metaschema_public.trigger_function (
database_id uuid NOT NULL,
name text NOT NULL,
code text,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand All @@ -421,6 +447,8 @@ CREATE TABLE metaschema_public.trigger (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -449,6 +477,8 @@ CREATE TABLE metaschema_public.unique_constraint (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -647,6 +677,8 @@ CREATE TABLE metaschema_public.embedding_chunks (
embedding_model text,
embedding_provider text,
parent_fk_field_id uuid,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -702,6 +734,8 @@ CREATE TABLE metaschema_public.spatial_relation (
module text NULL,
scope int NULL,
tags citext[] NOT NULL DEFAULT '{}',
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT db_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down Expand Up @@ -774,6 +808,8 @@ CREATE TABLE metaschema_public.partition (
premake int NOT NULL DEFAULT 2,
naming_pattern text NOT NULL DEFAULT '{parent}_{bounds}',
is_parented boolean NOT NULL DEFAULT false,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now(),
CONSTRAINT partition_database_fkey
FOREIGN KEY(database_id)
REFERENCES metaschema_public.database (id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

exports[`services functionality should handle complete meta workflow with services 1`] = `
{
"created_at": "[DATE]",
"hash": null,
"id": "[ID]",
"label": null,
"name": "my-meta-db",
"owner_id": "[ID]",
"schema_hash": null,
"updated_at": "[DATE]",
}
`;

Expand Down
Loading