fix various issues

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2024-01-13 23:46:33 +01:00 committed by Folling
parent 3c250702b9
commit c289344880
No known key found for this signature in database
12 changed files with 33 additions and 50 deletions

View file

@ -8,7 +8,7 @@
#include <sqlitecpp/connection.hpp>
namespace ikarus {
CPPBASE_ASSET(m1_initial_layout, "persistence/migrations/m1_initial_layout.sql");
CPPBASE_ASSET(m0_initial_layout, "persistence/migrations/m0_initial_layout.sql");
class Migration : public sqlitecpp::Migration {
public:

View file

@ -1,7 +0,0 @@
CREATE TABLE `metadata`
(
`key` VARCHAR(255) NOT NULL,
`value` VARCHAR(255) NOT NULL,
PRIMARY KEY (`key`)
)

View file

@ -1,27 +1,22 @@
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,
`type` INT NOT NULL,
`id` INT GENERATED ALWAYS AS (`do_not_access_rowid_alias` | (`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 INDEX `object_type` ON `objects` (`type`);
CREATE
VIRTUAL TABLE `objects_fts` USING fts5
CREATE VIRTUAL TABLE `objects_fts` USING fts5
(
`name`,
`information`,
content=
'objects',
content_rowid=
'id',
tokenize=
"unicode61 remove_diacritics 2 tokenchars '-_'"
content='objects',
content_rowid='id',
tokenize="unicode61 remove_diacritics 2 tokenchars '-_'"
);
CREATE TABLE `entities`
@ -73,24 +68,18 @@ CREATE
VIRTUAL TABLE `property_default_value_fts` USING fts5
(
`default_value`,
content=
'properties',
content_rowid=
'object_id',
tokenize=
"unicode61 remove_diacritics 2 tokenchars '-_'"
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 '-_'"
content='properties',
content_rowid='object_id',
tokenize="unicode61 remove_diacritics 2 tokenchars '-_'"
);
CREATE TABLE `values`
@ -108,8 +97,6 @@ CREATE
VIRTUAL TABLE `values_fts` USING fts5
(
`value`,
content=
'values',
tokenize=
"unicode61 remove_diacritics 2 tokenchars '-_'"
)
content='values',
tokenize="unicode61 remove_diacritics 2 tokenchars '-_'"
);

View file

@ -1,19 +1,17 @@
#include "project.hpp"
#include "migrations.hpp"
#include "ikarus/persistence/project.h"
#include <boost/filesystem.hpp>
#include <cppbase/strings.hpp>
#include <ikarus/persistence/project.h>
#include <objects/blueprint.hpp>
#include <objects/entity.hpp>
#include <objects/properties/number_property.hpp>
#include <objects/properties/property.hpp>
#include <objects/properties/text_property.hpp>
#include <objects/properties/toggle_property.hpp>
#include <persistence/migrations.hpp>
#include <persistence/project.hpp>
IkarusProject::IkarusProject(std::string_view name, std::string_view path, std::unique_ptr<sqlitecpp::Connection> && db):
name{name},