Skip to content

Commit 1dd1ef4

Browse files
committed
feat: add modelcatalog_software_category junction table and Hasura metadata
Add software-to-category many-to-many relationship for sdm:hasModelCategory on Software entities. Includes SQL migration with FK constraints, indexes, and Hasura metadata with bidirectional relationships and permissions.
1 parent eb4fd01 commit 1dd1ef4

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

metadata/tables.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,6 +2897,13 @@
28972897
table:
28982898
name: modelcatalog_software_author
28992899
schema: public
2900+
- name: categories
2901+
using:
2902+
foreign_key_constraint_on:
2903+
column: software_id
2904+
table:
2905+
name: modelcatalog_software_category
2906+
schema: public
29002907
insert_permissions:
29012908
- role: user
29022909
permission:
@@ -3776,6 +3783,13 @@
37763783
table:
37773784
name: modelcatalog_software_version_category
37783785
schema: public
3786+
- name: software_items
3787+
using:
3788+
foreign_key_constraint_on:
3789+
column: category_id
3790+
table:
3791+
name: modelcatalog_software_category
3792+
schema: public
37793793
insert_permissions:
37803794
- role: user
37813795
permission:
@@ -4672,6 +4686,38 @@
46724686
- role: user
46734687
permission:
46744688
filter: {}
4689+
- table:
4690+
name: modelcatalog_software_category
4691+
schema: public
4692+
object_relationships:
4693+
- name: software
4694+
using:
4695+
foreign_key_constraint_on: software_id
4696+
- name: category
4697+
using:
4698+
foreign_key_constraint_on: category_id
4699+
insert_permissions:
4700+
- role: user
4701+
permission:
4702+
check: {}
4703+
columns: &id040
4704+
- software_id
4705+
- category_id
4706+
select_permissions:
4707+
- role: anonymous
4708+
permission:
4709+
columns:
4710+
- software_id
4711+
- category_id
4712+
filter: {}
4713+
- role: user
4714+
permission:
4715+
columns: *id040
4716+
filter: {}
4717+
delete_permissions:
4718+
- role: user
4719+
permission:
4720+
filter: {}
46754721
- table:
46764722
name: modelcatalog_version_author
46774723
schema: public
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE IF EXISTS modelcatalog_software_category;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Software <-> ModelCategory junction table
2+
CREATE TABLE modelcatalog_software_category (
3+
software_id TEXT REFERENCES modelcatalog_software(id) ON DELETE CASCADE,
4+
category_id TEXT REFERENCES modelcatalog_model_category(id) ON DELETE CASCADE,
5+
PRIMARY KEY (software_id, category_id)
6+
);
7+
8+
CREATE INDEX idx_mc_sw_cat_sw ON modelcatalog_software_category(software_id);
9+
CREATE INDEX idx_mc_sw_cat_cat ON modelcatalog_software_category(category_id);

0 commit comments

Comments
 (0)