@pgpm/metaschema-schema 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/deploy/schemas/metaschema_public/tables/enum/table.sql +41 -0
- package/package.json +6 -6
- package/pgpm.plan +1 -0
- package/revert/schemas/metaschema_public/tables/enum/table.sql +7 -0
- package/sql/metaschema-schema--0.15.5.sql +32 -0
- package/verify/schemas/metaschema_public/tables/enum/table.sql +7 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @pgpm/
|
|
1
|
+
# @pgpm/metaschema-schema
|
|
2
2
|
|
|
3
3
|
<p align="center" width="100%">
|
|
4
4
|
<img height="250" src="https://raw.githubusercontent.com/constructive-io/constructive/refs/heads/main/assets/outline-logo.svg" />
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
<img height="20" src="https://github.com/constructive-io/pgpm-modules/actions/workflows/ci.yml/badge.svg" />
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://github.com/constructive-io/pgpm-modules/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/@pgpm/
|
|
12
|
+
<a href="https://www.npmjs.com/package/@pgpm/metaschema-schema"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/pgpm-modules?filename=packages%2Fmetaschema-schema%2Fpackage.json"/></a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
Database metadata utilities and introspection functions.
|
|
16
16
|
|
|
17
17
|
## Overview
|
|
18
18
|
|
|
19
|
-
`@pgpm/
|
|
19
|
+
`@pgpm/metaschema-schema` provides a comprehensive metadata management system for PostgreSQL databases. This package creates tables and schemas for storing and querying database structure information including databases, schemas, tables, fields, constraints, indexes, and more. It enables runtime schema introspection, metadata-driven code generation, and database structure management.
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
@@ -34,7 +34,7 @@ Database metadata utilities and introspection functions.
|
|
|
34
34
|
If you have `pgpm` installed:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
pgpm install @pgpm/
|
|
37
|
+
pgpm install @pgpm/metaschema-schema
|
|
38
38
|
pgpm deploy
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -57,7 +57,7 @@ eval "$(pgpm env)"
|
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
# 1. Install the package
|
|
60
|
-
pgpm install @pgpm/
|
|
60
|
+
pgpm install @pgpm/metaschema-schema
|
|
61
61
|
|
|
62
62
|
# 2. Deploy locally
|
|
63
63
|
pgpm deploy
|
|
@@ -75,7 +75,7 @@ pgpm init
|
|
|
75
75
|
|
|
76
76
|
# 3. Install a package
|
|
77
77
|
cd packages/my-module
|
|
78
|
-
pgpm install @pgpm/
|
|
78
|
+
pgpm install @pgpm/metaschema-schema
|
|
79
79
|
|
|
80
80
|
# 4. Deploy everything
|
|
81
81
|
pgpm deploy --createdb --database mydb1
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
-- Deploy schemas/metaschema_public/tables/enum/table to pg
|
|
2
|
+
|
|
3
|
+
-- requires: schemas/metaschema_public/schema
|
|
4
|
+
-- requires: schemas/metaschema_public/tables/database/table
|
|
5
|
+
-- requires: schemas/metaschema_public/tables/schema/table
|
|
6
|
+
-- requires: schemas/metaschema_public/types/object_category
|
|
7
|
+
|
|
8
|
+
BEGIN;
|
|
9
|
+
|
|
10
|
+
CREATE TABLE metaschema_public.enum (
|
|
11
|
+
id uuid PRIMARY KEY DEFAULT uuid_generate_v4 (),
|
|
12
|
+
database_id uuid NOT NULL,
|
|
13
|
+
schema_id uuid NOT NULL,
|
|
14
|
+
name text NOT NULL,
|
|
15
|
+
|
|
16
|
+
label text,
|
|
17
|
+
description text,
|
|
18
|
+
|
|
19
|
+
values text[] NOT NULL DEFAULT '{}',
|
|
20
|
+
|
|
21
|
+
smart_tags jsonb,
|
|
22
|
+
|
|
23
|
+
category metaschema_public.object_category NOT NULL DEFAULT 'app',
|
|
24
|
+
module text NULL,
|
|
25
|
+
scope int NULL,
|
|
26
|
+
|
|
27
|
+
tags citext[] NOT NULL DEFAULT '{}',
|
|
28
|
+
|
|
29
|
+
CONSTRAINT db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE,
|
|
30
|
+
CONSTRAINT schema_fkey FOREIGN KEY (schema_id) REFERENCES metaschema_public.schema (id) ON DELETE CASCADE,
|
|
31
|
+
|
|
32
|
+
UNIQUE (schema_id, name)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
COMMENT ON CONSTRAINT db_fkey ON metaschema_public.enum IS E'@omit manyToMany';
|
|
36
|
+
COMMENT ON CONSTRAINT schema_fkey ON metaschema_public.enum IS E'@omit manyToMany';
|
|
37
|
+
|
|
38
|
+
CREATE INDEX enum_schema_id_idx ON metaschema_public.enum ( schema_id );
|
|
39
|
+
CREATE INDEX enum_database_id_idx ON metaschema_public.enum ( database_id );
|
|
40
|
+
|
|
41
|
+
COMMIT;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpm/metaschema-schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Database metadata utilities and introspection functions",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"test:watch": "jest --watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@pgpm/database-jobs": "0.
|
|
25
|
-
"@pgpm/inflection": "0.
|
|
26
|
-
"@pgpm/types": "0.
|
|
27
|
-
"@pgpm/verify": "0.
|
|
24
|
+
"@pgpm/database-jobs": "0.19.0",
|
|
25
|
+
"@pgpm/inflection": "0.19.0",
|
|
26
|
+
"@pgpm/types": "0.19.0",
|
|
27
|
+
"@pgpm/verify": "0.19.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"pgpm": "^4.2.3"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"bugs": {
|
|
38
38
|
"url": "https://github.com/constructive-io/pgpm-modules/issues"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "83be2dd4b07831c8c4f903437d20d350a673d19b"
|
|
41
41
|
}
|
package/pgpm.plan
CHANGED
|
@@ -28,3 +28,4 @@ schemas/metaschema_public/tables/view_table/table [schemas/metaschema_public/sch
|
|
|
28
28
|
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
|
|
29
29
|
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
|
|
30
30
|
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
|
|
31
|
+
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
|
|
@@ -508,3 +508,35 @@ COMMENT ON CONSTRAINT db_fkey ON metaschema_public.unique_constraint IS '@omit m
|
|
|
508
508
|
CREATE INDEX unique_constraint_table_id_idx ON metaschema_public.unique_constraint (table_id);
|
|
509
509
|
|
|
510
510
|
CREATE INDEX unique_constraint_database_id_idx ON metaschema_public.unique_constraint (database_id);
|
|
511
|
+
|
|
512
|
+
CREATE TABLE metaschema_public.enum (
|
|
513
|
+
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
514
|
+
database_id uuid NOT NULL,
|
|
515
|
+
schema_id uuid NOT NULL,
|
|
516
|
+
name text NOT NULL,
|
|
517
|
+
label text,
|
|
518
|
+
description text,
|
|
519
|
+
values text[] NOT NULL DEFAULT '{}',
|
|
520
|
+
smart_tags jsonb,
|
|
521
|
+
category metaschema_public.object_category NOT NULL DEFAULT 'app',
|
|
522
|
+
module text NULL,
|
|
523
|
+
scope int NULL,
|
|
524
|
+
tags citext[] NOT NULL DEFAULT '{}',
|
|
525
|
+
CONSTRAINT db_fkey
|
|
526
|
+
FOREIGN KEY(database_id)
|
|
527
|
+
REFERENCES metaschema_public.database (id)
|
|
528
|
+
ON DELETE CASCADE,
|
|
529
|
+
CONSTRAINT schema_fkey
|
|
530
|
+
FOREIGN KEY(schema_id)
|
|
531
|
+
REFERENCES metaschema_public.schema (id)
|
|
532
|
+
ON DELETE CASCADE,
|
|
533
|
+
UNIQUE (schema_id, name)
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
COMMENT ON CONSTRAINT db_fkey ON metaschema_public.enum IS '@omit manyToMany';
|
|
537
|
+
|
|
538
|
+
COMMENT ON CONSTRAINT schema_fkey ON metaschema_public.enum IS '@omit manyToMany';
|
|
539
|
+
|
|
540
|
+
CREATE INDEX enum_schema_id_idx ON metaschema_public.enum (schema_id);
|
|
541
|
+
|
|
542
|
+
CREATE INDEX enum_database_id_idx ON metaschema_public.enum (database_id);
|