implement blueprint functionality & streamline API
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
a2b5c573b2
commit
d3e93b6a72
9 changed files with 175 additions and 229 deletions
|
|
@ -2,8 +2,7 @@ CREATE TABLE `objects`
|
|||
(
|
||||
`do_not_access_rowid_alias` INTEGER PRIMARY KEY,
|
||||
`object_type` INT NOT NULL,
|
||||
`id` INT GENERATED ALWAYS AS (`do_not_access_rowid_alias` | (`object_type` << 56)
|
||||
) VIRTUAL,
|
||||
`id` INT GENERATED ALWAYS AS (`do_not_access_rowid_alias` | (`object_type` << 56)) VIRTUAL,
|
||||
`name` TEXT NOT NULL,
|
||||
`information` TEXT NOT NULL
|
||||
) STRICT;
|
||||
|
|
@ -47,6 +46,7 @@ CREATE TABLE `entity_blueprints`
|
|||
|
||||
PRIMARY KEY (`entity`),
|
||||
UNIQUE (`entity`, `blueprint`),
|
||||
FOREIGN KEY (`entity`) REFERENCES `entities` (`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`blueprint`) REFERENCES `blueprints` (`id`) ON DELETE CASCADE
|
||||
) WITHOUT ROWID, STRICT;
|
||||
|
||||
|
|
@ -58,12 +58,15 @@ CREATE TABLE `properties`
|
|||
`type` INT NOT NULL,
|
||||
`default_value` TEXT NOT NULL,
|
||||
`settings` TEXT NOT NULL,
|
||||
`source` INT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id`) REFERENCES `objects` (`id`) ON DELETE CASCADE
|
||||
FOREIGN KEY (`id`) REFERENCES `objects` (`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`source`) REFERENCES `objects` (`id`) ON DELETE CASCADE
|
||||
) WITHOUT ROWID, STRICT;
|
||||
|
||||
CREATE INDEX `properties_type` ON `properties` (`type`);
|
||||
CREATE INDEX `properties_source` ON `properties` (`source`);
|
||||
|
||||
CREATE
|
||||
VIRTUAL TABLE `property_default_value_fts` USING fts5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue