Skip to content

Commit ab53e53

Browse files
committed
feat: provision graph_execution_module for platform database
Add pgpm seed migrations that register the full module chain: 1. seed_graph_execution_tables: register merkle + graph execution tables in metaschema 2. register_graph_execution_module: provision merkle_store_module → graph_module → graph_execution_module This resolves 'Module not provisioned' errors when the compute worker attempts to resolve graph execution config via the ModuleLoader.
1 parent 53e119e commit ab53e53

7 files changed

Lines changed: 253 additions & 0 deletions

File tree

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
-- Deploy: fixtures/register_graph_execution_module
2+
-- made with <3 @ constructive.io
3+
4+
-- requires: fixtures/seed_graph_execution_tables
5+
-- requires: metaschema-modules:schemas/metaschema_modules_public/tables/merkle_store_module/table
6+
-- requires: metaschema-modules:schemas/metaschema_modules_public/tables/graph_module/table
7+
-- requires: metaschema-modules:schemas/metaschema_modules_public/tables/graph_execution_module/table
8+
9+
BEGIN;
10+
11+
-- 1. Register merkle_store_module for the platform function graph.
12+
13+
INSERT INTO metaschema_modules_public.merkle_store_module (
14+
database_id,
15+
schema_id,
16+
private_schema_id,
17+
public_schema_name,
18+
private_schema_name,
19+
object_table_id,
20+
store_table_id,
21+
commit_table_id,
22+
ref_table_id,
23+
prefix,
24+
scope
25+
)
26+
SELECT
27+
'00000000-0000-0000-0000-000000000000',
28+
pub.id,
29+
priv.id,
30+
'constructive_platform_function_graph_public',
31+
'constructive_platform_function_graph_private',
32+
obj.id,
33+
store.id,
34+
cmt.id,
35+
ref.id,
36+
'platform_function_graph',
37+
'platform'
38+
FROM metaschema_public.schema pub
39+
JOIN metaschema_public.schema priv
40+
ON priv.database_id = '00000000-0000-0000-0000-000000000000'
41+
AND priv.schema_name = 'constructive_platform_function_graph_private'
42+
JOIN metaschema_public."table" obj
43+
ON obj.database_id = '00000000-0000-0000-0000-000000000000'
44+
AND obj.name = 'platform_function_graph_object'
45+
JOIN metaschema_public."table" store
46+
ON store.database_id = '00000000-0000-0000-0000-000000000000'
47+
AND store.name = 'platform_function_graph_store'
48+
JOIN metaschema_public."table" cmt
49+
ON cmt.database_id = '00000000-0000-0000-0000-000000000000'
50+
AND cmt.name = 'platform_function_graph_commit'
51+
JOIN metaschema_public."table" ref
52+
ON ref.database_id = '00000000-0000-0000-0000-000000000000'
53+
AND ref.name = 'platform_function_graph_ref'
54+
WHERE pub.database_id = '00000000-0000-0000-0000-000000000000'
55+
AND pub.schema_name = 'constructive_platform_function_graph_public'
56+
ON CONFLICT DO NOTHING;
57+
58+
-- 2. Register graph_module for the platform function graph.
59+
60+
INSERT INTO metaschema_modules_public.graph_module (
61+
database_id,
62+
public_schema_id,
63+
private_schema_id,
64+
public_schema_name,
65+
private_schema_name,
66+
merkle_store_module_id,
67+
scope,
68+
prefix
69+
)
70+
SELECT
71+
'00000000-0000-0000-0000-000000000000',
72+
pub.id,
73+
priv.id,
74+
'constructive_platform_function_graph_public',
75+
'constructive_platform_function_graph_private',
76+
msm.id,
77+
'platform',
78+
'platform_function_graph'
79+
FROM metaschema_public.schema pub
80+
JOIN metaschema_public.schema priv
81+
ON priv.database_id = '00000000-0000-0000-0000-000000000000'
82+
AND priv.schema_name = 'constructive_platform_function_graph_private'
83+
JOIN metaschema_modules_public.merkle_store_module msm
84+
ON msm.database_id = '00000000-0000-0000-0000-000000000000'
85+
AND msm.prefix = 'platform_function_graph'
86+
WHERE pub.database_id = '00000000-0000-0000-0000-000000000000'
87+
AND pub.schema_name = 'constructive_platform_function_graph_public'
88+
ON CONFLICT DO NOTHING;
89+
90+
-- 3. Register graph_execution_module for graph execution tracking.
91+
92+
INSERT INTO metaschema_modules_public.graph_execution_module (
93+
database_id,
94+
schema_id,
95+
private_schema_id,
96+
public_schema_name,
97+
private_schema_name,
98+
graph_module_id,
99+
executions_table_id,
100+
outputs_table_id,
101+
node_states_table_id,
102+
executions_table_name,
103+
outputs_table_name,
104+
node_states_table_name,
105+
scope,
106+
prefix
107+
)
108+
SELECT
109+
'00000000-0000-0000-0000-000000000000',
110+
pub.id,
111+
priv.id,
112+
'constructive_compute_public',
113+
'constructive_compute_private',
114+
gm.id,
115+
exec_t.id,
116+
out_t.id,
117+
ns_t.id,
118+
'platform_function_graph_executions',
119+
'platform_function_graph_execution_outputs',
120+
'platform_function_graph_execution_node_states',
121+
'platform',
122+
'platform'
123+
FROM metaschema_public.schema pub
124+
JOIN metaschema_public.schema priv
125+
ON priv.database_id = '00000000-0000-0000-0000-000000000000'
126+
AND priv.schema_name = 'constructive_compute_private'
127+
JOIN metaschema_modules_public.graph_module gm
128+
ON gm.database_id = '00000000-0000-0000-0000-000000000000'
129+
AND gm.prefix = 'platform_function_graph'
130+
JOIN metaschema_public."table" exec_t
131+
ON exec_t.database_id = '00000000-0000-0000-0000-000000000000'
132+
AND exec_t.name = 'platform_function_graph_executions'
133+
JOIN metaschema_public."table" out_t
134+
ON out_t.database_id = '00000000-0000-0000-0000-000000000000'
135+
AND out_t.name = 'platform_function_graph_execution_outputs'
136+
JOIN metaschema_public."table" ns_t
137+
ON ns_t.database_id = '00000000-0000-0000-0000-000000000000'
138+
AND ns_t.name = 'platform_function_graph_execution_node_states'
139+
WHERE pub.database_id = '00000000-0000-0000-0000-000000000000'
140+
AND pub.schema_name = 'constructive_compute_public'
141+
ON CONFLICT DO NOTHING;
142+
143+
COMMIT;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
-- Deploy: fixtures/seed_graph_execution_tables
2+
-- made with <3 @ constructive.io
3+
4+
-- requires: fixtures/seed_schemas
5+
-- requires: metaschema-schema:schemas/metaschema_public/tables/table/table
6+
7+
BEGIN;
8+
9+
-- Register merkle store tables (in graph schema) so merkle_store_module FKs resolve.
10+
11+
INSERT INTO metaschema_public."table" (database_id, schema_id, name)
12+
SELECT
13+
'00000000-0000-0000-0000-000000000000',
14+
s.id,
15+
t.name
16+
FROM metaschema_public.schema s
17+
CROSS JOIN (VALUES
18+
('platform_function_graph_object'),
19+
('platform_function_graph_store'),
20+
('platform_function_graph_commit'),
21+
('platform_function_graph_ref')
22+
) AS t(name)
23+
WHERE s.database_id = '00000000-0000-0000-0000-000000000000'
24+
AND s.schema_name = 'constructive_platform_function_graph_public'
25+
ON CONFLICT DO NOTHING;
26+
27+
-- Register graph execution tables (in compute schema) so graph_execution_module FKs resolve.
28+
29+
INSERT INTO metaschema_public."table" (database_id, schema_id, name)
30+
SELECT
31+
'00000000-0000-0000-0000-000000000000',
32+
s.id,
33+
t.name
34+
FROM metaschema_public.schema s
35+
CROSS JOIN (VALUES
36+
('platform_function_graph_executions'),
37+
('platform_function_graph_execution_outputs'),
38+
('platform_function_graph_execution_node_states')
39+
) AS t(name)
40+
WHERE s.database_id = '00000000-0000-0000-0000-000000000000'
41+
AND s.schema_name = 'constructive_compute_public'
42+
ON CONFLICT DO NOTHING;
43+
44+
COMMIT;

pgpm/constructive-platform-seed/pgpm.plan

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ fixtures/seed_domain [fixtures/seed_compute_api services:schemas/services_public
1111
fixtures/seed_site [fixtures/seed_database services:schemas/services_public/tables/sites/table services:schemas/services_public/tables/domains/table] 2026-06-08T05:00:00Z Constructive <developers@constructive.io> # create platform site and site domain
1212
fixtures/seed_compute_log_tables [fixtures/seed_schemas metaschema-schema:schemas/metaschema_public/tables/table/table] 2026-06-08T05:00:00Z Constructive <developers@constructive.io> # register compute_log + usage_daily tables in metaschema
1313
fixtures/register_compute_log_module [fixtures/seed_compute_log_tables metaschema-modules:schemas/metaschema_modules_public/tables/compute_log_module/table] 2026-06-08T05:00:00Z Constructive <developers@constructive.io> # register compute_log_module for usage tracking
14+
fixtures/seed_graph_execution_tables [fixtures/seed_schemas metaschema-schema:schemas/metaschema_public/tables/table/table] 2026-06-08T05:00:00Z Constructive <developers@constructive.io> # register graph + merkle tables in metaschema for module FK references
15+
fixtures/register_graph_execution_module [fixtures/seed_graph_execution_tables metaschema-modules:schemas/metaschema_modules_public/tables/merkle_store_module/table metaschema-modules:schemas/metaschema_modules_public/tables/graph_module/table metaschema-modules:schemas/metaschema_modules_public/tables/graph_execution_module/table] 2026-06-08T05:00:00Z Constructive <developers@constructive.io> # register merkle_store_module + graph_module + graph_execution_module
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- Revert: fixtures/register_graph_execution_module
2+
3+
BEGIN;
4+
5+
DELETE FROM metaschema_modules_public.graph_execution_module
6+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
7+
AND scope = 'platform';
8+
9+
DELETE FROM metaschema_modules_public.graph_module
10+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
11+
AND prefix = 'platform_function_graph';
12+
13+
DELETE FROM metaschema_modules_public.merkle_store_module
14+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
15+
AND prefix = 'platform_function_graph';
16+
17+
COMMIT;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- Revert: fixtures/seed_graph_execution_tables
2+
3+
BEGIN;
4+
5+
DELETE FROM metaschema_public."table"
6+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
7+
AND name IN (
8+
'platform_function_graph_object',
9+
'platform_function_graph_store',
10+
'platform_function_graph_commit',
11+
'platform_function_graph_ref',
12+
'platform_function_graph_executions',
13+
'platform_function_graph_execution_outputs',
14+
'platform_function_graph_execution_node_states'
15+
);
16+
17+
COMMIT;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- Verify: fixtures/register_graph_execution_module
2+
3+
BEGIN;
4+
5+
SELECT 1 FROM metaschema_modules_public.merkle_store_module
6+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
7+
AND prefix = 'platform_function_graph';
8+
9+
SELECT 1 FROM metaschema_modules_public.graph_module
10+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
11+
AND prefix = 'platform_function_graph';
12+
13+
SELECT 1 FROM metaschema_modules_public.graph_execution_module
14+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
15+
AND scope = 'platform';
16+
17+
ROLLBACK;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Verify: fixtures/seed_graph_execution_tables
2+
3+
BEGIN;
4+
5+
SELECT 1 FROM metaschema_public."table"
6+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
7+
AND name = 'platform_function_graph_object';
8+
9+
SELECT 1 FROM metaschema_public."table"
10+
WHERE database_id = '00000000-0000-0000-0000-000000000000'
11+
AND name = 'platform_function_graph_executions';
12+
13+
ROLLBACK;

0 commit comments

Comments
 (0)