From bd76535c56db09b0fd7657a4c058f94f90cdfcca Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Tue, 13 May 2025 20:10:36 +0200 Subject: [PATCH] register notebook type --- application/store_sqlite.c | 10 ++++++++++ application/types.c | 6 ++++++ application/types.h | 1 + 3 files changed, 17 insertions(+) diff --git a/application/store_sqlite.c b/application/store_sqlite.c index 5f9bf57..79c8d86 100644 --- a/application/store_sqlite.c +++ b/application/store_sqlite.c @@ -78,6 +78,15 @@ "targetdate integer, " \ "foreign key (resource_id) references resources(resource_id) on delete cascade " \ ");" +#define SQL_CREATE_TABLE_NOTEBOOKS "create table notebooks( " \ + "notebook_id integer primary key, " \ + "resource_id integer, " \ + "repository_id integer, " \ + "type integer, " \ + "position integer, " \ + "foreign key (resource_id) references resources(resource_id) on delete cascade, " \ + "foreign key (repository_id) references repositories(repository_id) on delete cascade " \ + ");" #define SQL_CREATE_TABLE_ATTACHMENTS "create table attachments( " \ "attachment_id integer primary key, " \ "attachment_resource_id integer, " \ @@ -93,6 +102,7 @@ int store_sqlite_init_db(DBUConnection *connection) { SQL_CREATE_TABLE_REPOSITORIES, SQL_CREATE_TABLE_USER_SETTINGS, SQL_CREATE_TABLE_RESOURCES, + SQL_CREATE_TABLE_NOTEBOOKS, SQL_CREATE_TABLE_NOTES, SQL_CREATE_TABLE_ATTACHMENTS }; diff --git a/application/types.c b/application/types.c index f0f5341..c3f39d9 100644 --- a/application/types.c +++ b/application/types.c @@ -71,6 +71,12 @@ void register_types() { dbuClassAdd(note_class, Note, targetdate); dbuClassAddObj(note_class, "resource_id", offsetof(Note, resource), resource_class); + notebook_class = dbuRegisterClass(ctx, "notebooks", Notebook, notebook_id); + dbuClassAdd(notebook_class, Notebook, resource_id); + dbuClassAdd(notebook_class, Notebook, repository_id); + dbuClassAdd(notebook_class, Notebook, type); + dbuClassAdd(notebook_class, Notebook, position); + repository_class = dbuRegisterClass(ctx, "repositories", Repository, repository_id); dbuClassAdd(repository_class, Repository, name); dbuClassAdd(repository_class, Repository, url); diff --git a/application/types.h b/application/types.h index 97a72e9..993dbdf 100644 --- a/application/types.h +++ b/application/types.h @@ -106,6 +106,7 @@ struct Notebook { int64_t resource_id; int64_t repository_id; int type; + int position; }; struct Note { -- 2.43.5