intermediate commit
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
52580a4382
commit
2ab0109355
37 changed files with 131 additions and 1544 deletions
111
src/persistence/migrations/m1_initial_layout.sql
Normal file
111
src/persistence/migrations/m1_initial_layout.sql
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
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,
|
||||
`name` TEXT NOT NULL,
|
||||
`information` TEXT NOT NULL
|
||||
) STRICT;
|
||||
|
||||
CREATE UNIQUE INDEX `object_id` ON `objects` (`id`);
|
||||
CREATE INDEX `object_type` ON `objects` (`object_type`);
|
||||
|
||||
CREATE
|
||||
VIRTUAL TABLE `objects_fts` USING fts5
|
||||
(
|
||||
`name`,
|
||||
`information`,
|
||||
content=
|
||||
'objects',
|
||||
content_rowid=
|
||||
'id',
|
||||
tokenize=
|
||||
"unicode61 remove_diacritics 2 tokenchars '-_'"
|
||||
);
|
||||
|
||||
CREATE TABLE `blueprints`
|
||||
(
|
||||
`id` INT,
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id`) REFERENCES `objects` (`id`) ON DELETE CASCADE
|
||||
) WITHOUT ROWID, STRICT;
|
||||
|
||||
CREATE TABLE `entities`
|
||||
(
|
||||
`id` INT,
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id`) REFERENCES `objects` (`id`) ON DELETE CASCADE
|
||||
) WITHOUT ROWID, STRICT;
|
||||
|
||||
CREATE TABLE `entity_blueprints`
|
||||
(
|
||||
`entity` INT NOT NULL,
|
||||
`blueprint` INT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`entity`),
|
||||
UNIQUE (`entity`, `blueprint`),
|
||||
FOREIGN KEY (`blueprint`) REFERENCES `blueprints` (`id`) ON DELETE CASCADE
|
||||
) WITHOUT ROWID, STRICT;
|
||||
|
||||
CREATE INDEX `entity_blueprints_blueprint` ON `entity_blueprints` (`blueprint`);
|
||||
|
||||
CREATE TABLE `properties`
|
||||
(
|
||||
`id` INT,
|
||||
`type` INT NOT NULL,
|
||||
`default_value` TEXT NOT NULL,
|
||||
`settings` TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id`) REFERENCES `objects` (`id`) ON DELETE CASCADE
|
||||
) WITHOUT ROWID, STRICT;
|
||||
|
||||
CREATE INDEX `properties_type` ON `properties` (`type`);
|
||||
|
||||
CREATE
|
||||
VIRTUAL TABLE `property_default_value_fts` USING fts5
|
||||
(
|
||||
`default_value`,
|
||||
content=
|
||||
'properties',
|
||||
content_rowid=
|
||||
'object_id',
|
||||
tokenize=
|
||||
"unicode61 remove_diacritics 2 tokenchars '-_'"
|
||||
);
|
||||
|
||||
CREATE
|
||||
VIRTUAL TABLE `property_settings_fts` USING fts5
|
||||
(
|
||||
`settings`,
|
||||
content=
|
||||
'properties',
|
||||
content_rowid=
|
||||
'object_id',
|
||||
tokenize=
|
||||
"unicode61 remove_diacritics 2 tokenchars '-_'"
|
||||
);
|
||||
|
||||
CREATE TABLE `values`
|
||||
(
|
||||
`entity` INT NOT NULL,
|
||||
`property` INT NOT NULL,
|
||||
`value` TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`entity`, `property`),
|
||||
FOREIGN KEY (`entity`) REFERENCES `entities` (`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`property`) REFERENCES `properties` (`id`) ON DELETE CASCADE
|
||||
) WITHOUT ROWID, STRICT;
|
||||
|
||||
CREATE
|
||||
VIRTUAL TABLE `values_fts` USING fts5
|
||||
(
|
||||
`value`,
|
||||
content=
|
||||
'values',
|
||||
tokenize=
|
||||
"unicode61 remove_diacritics 2 tokenchars '-_'"
|
||||
)
|
||||
11
src/persistence/project.hpp
Normal file
11
src/persistence/project.hpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
#include <sqlitecpp/connection.hpp>
|
||||
|
||||
/// \private
|
||||
struct IkarusProject {
|
||||
std::string name;
|
||||
std::filesystem::path path;
|
||||
std::unique_ptr<sqlitecpp::Connection> db;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue