Skip to content

Commit a2d9075

Browse files
committed
feat: update RelationManyToMany types - replace node_type/node_data with nodes[] array
Matches constructive-db PR #723 which redesigns secure_table_provision and relation_provision to use a nodes jsonb array instead of separate node_type/node_data columns.
1 parent 091694a commit a2d9075

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

graphql/node-type-registry/src/blueprint-types.generated.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ export interface RelationHasManyParams {
558558
/* Whether the FK field is NOT NULL */
559559
is_required?: boolean;
560560
}
561-
/** Creates a junction table between source and target tables with auto-derived naming and FK fields. The trigger creates a bare table (no implicit DataId or any node_type), adds FK fields to both tables, optionally creates a composite PK (use_composite_key), then forwards all security config to secure_table_provision as-is. The trigger never injects values the caller did not provide. Junction table FKs always CASCADE on delete. */
561+
/** Creates a junction table between source and target tables with auto-derived naming and FK fields. The trigger creates a bare table (no implicit DataId), adds FK fields to both tables, optionally creates a composite PK (use_composite_key), then forwards all security config to secure_table_provision as-is. The trigger never injects values the caller did not provide. Junction table FKs always CASCADE on delete. */
562562
export interface RelationManyToManyParams {
563563
/* First table in the M:N relationship */
564564
source_table_id: string;
@@ -572,14 +572,12 @@ export interface RelationManyToManyParams {
572572
source_field_name?: string;
573573
/* FK field name on junction for target table. Auto-derived if omitted (e.g., tags derives tag_id) */
574574
target_field_name?: string;
575-
/* When true, creates a composite PK from the two FK fields. When false, no PK is created by the trigger (use node_type=DataId for UUID PK). Mutually exclusive with node_type=DataId. */
575+
/* When true, creates a composite PK from the two FK fields. When false, no PK is created by the trigger (use nodes with DataId for UUID PK). Mutually exclusive with nodes containing DataId. */
576576
use_composite_key?: boolean;
577-
/* Generator for field creation on junction table. Forwarded to secure_table_provision as-is. Examples: DataId, DataEntityMembership, DataDirectOwner. NULL means no additional fields. */
578-
node_type?: string;
579-
/* Configuration for the generator. Forwarded to secure_table_provision as-is. Only used when node_type is set. */
580-
node_data?: {
577+
/* Array of node objects for field creation on junction table. Each object has a $type key (e.g. DataId, DataEntityMembership) and optional data keys. Forwarded to secure_table_provision as-is. Empty array means no additional fields. */
578+
nodes?: {
581579
[key: string]: unknown;
582-
};
580+
}[];
583581
/* Database roles to grant privileges to. Forwarded to secure_table_provision as-is. Default: [authenticated] */
584582
grant_roles?: string[];
585583
/* Privilege grants for the junction table as [verb, columns] tuples (e.g. [['select','*'],['insert','*']]). Forwarded to secure_table_provision as-is. Default: select/insert/delete for all columns */

graphql/node-type-registry/src/relation/relation-many-to-many.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const RelationManyToMany: NodeTypeDefinition = {
55
"slug": "relation_many_to_many",
66
"category": "relation",
77
"display_name": "Many to Many",
8-
"description": "Creates a junction table between source and target tables with auto-derived naming and FK fields. The trigger creates a bare table (no implicit DataId or any node_type), adds FK fields to both tables, optionally creates a composite PK (use_composite_key), then forwards all security config to secure_table_provision as-is. The trigger never injects values the caller did not provide. Junction table FKs always CASCADE on delete.",
8+
"description": "Creates a junction table between source and target tables with auto-derived naming and FK fields. The trigger creates a bare table (no implicit DataId), adds FK fields to both tables, optionally creates a composite PK (use_composite_key), then forwards all security config to secure_table_provision as-is. The trigger never injects values the caller did not provide. Junction table FKs always CASCADE on delete.",
99
"parameter_schema": {
1010
"type": "object",
1111
"properties": {
@@ -38,16 +38,15 @@ export const RelationManyToMany: NodeTypeDefinition = {
3838
},
3939
"use_composite_key": {
4040
"type": "boolean",
41-
"description": "When true, creates a composite PK from the two FK fields. When false, no PK is created by the trigger (use node_type=DataId for UUID PK). Mutually exclusive with node_type=DataId.",
41+
"description": "When true, creates a composite PK from the two FK fields. When false, no PK is created by the trigger (use nodes with DataId for UUID PK). Mutually exclusive with nodes containing DataId.",
4242
"default": false
4343
},
44-
"node_type": {
45-
"type": "string",
46-
"description": "Generator for field creation on junction table. Forwarded to secure_table_provision as-is. Examples: DataId, DataEntityMembership, DataDirectOwner. NULL means no additional fields."
47-
},
48-
"node_data": {
49-
"type": "object",
50-
"description": "Configuration for the generator. Forwarded to secure_table_provision as-is. Only used when node_type is set."
44+
"nodes": {
45+
"type": "array",
46+
"items": {
47+
"type": "object"
48+
},
49+
"description": "Array of node objects for field creation on junction table. Each object has a $type key (e.g. DataId, DataEntityMembership) and optional data keys. Forwarded to secure_table_provision as-is. Empty array means no additional fields."
5150
},
5251
"grant_roles": {
5352
"type": "array",

0 commit comments

Comments
 (0)