Skip to content

Commit

Permalink
add support for labels in the model
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Davis <[email protected]>
  • Loading branch information
duglin committed Dec 27, 2024
1 parent 2a1c157 commit 39f6930
Show file tree
Hide file tree
Showing 4 changed files with 1,034 additions and 42 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ test: .test .testimage
@make mysql waitformysql
@echo
@echo "# Testing"
@! grep -P '\t' registry/init.sql || (echo "Remove tabs in init.db";exit 1)
@go clean -testcache
@echo "go test -failfast $(TESTDIRS)"
@for s in $(TESTDIRS); do if ! go test -failfast $$s; then exit 1; fi; done
Expand Down
21 changes: 12 additions & 9 deletions registry/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ SET sql_mode = 'ANSI_QUOTES' ;
CREATE TABLE Registries (
SID VARCHAR(255) NOT NULL, # System ID
UID VARCHAR(255) NOT NULL, # User defined
Attributes JSON, # Until we use the Attributes table

PRIMARY KEY (SID),
UNIQUE INDEX (UID)
Expand All @@ -52,6 +51,9 @@ END ;
CREATE TABLE Models (
RegistrySID VARCHAR(64) NOT NULL,

Labels JSON,
Attributes JSON, # Until we use the Attributes table

PRIMARY KEY (RegistrySID)
);

Expand All @@ -77,6 +79,7 @@ CREATE TABLE ModelEntities ( # Group or Resource (no parent=Group)
HasDocument BOOL,
ReadOnly BOOL,
TypeMap JSON,
Labels JSON,
MetaAttributes JSON,

PRIMARY KEY(SID),
Expand Down Expand Up @@ -355,10 +358,10 @@ FROM EffectiveVersions AS v ;
CREATE VIEW xRefProps AS
SELECT
xR.RegistrySID,
Ms.SID AS EntitySID,
P.PropName,
P.PropValue,
P.PropType
Ms.SID AS EntitySID,
P.PropName,
P.PropValue,
P.PropType
FROM xRefSrc2TgtResources AS xR
JOIN Metas AS Ms ON (Ms.ResourceSID=xR.SourceSID)
JOIN Metas AS Mt ON (Mt.ResourceSID=xR.TargetSID)
Expand Down Expand Up @@ -424,10 +427,10 @@ WHERE p1.PropName='defaultVersionId$DB_IN' AND v.UID=p1.PropValue
/*
SELECT
m.RegistrySID,
m.ResourceSID AS EntitySID,
p.PropName,
p.PropValue,
p.PropType
m.ResourceSID AS EntitySID,
p.PropName,
p.PropValue,
p.PropType
FROM Metas m
JOIN EffectiveProps AS dvp ON (dvp.EntitySID=m.SID AND
dvp.PropName='defaultVersionId,')
Expand Down
Loading

0 comments on commit 39f6930

Please sign in to comment.