Closed nmccarty closed 1 year ago
I think nodes should also have a path
or url
field. This would be useful to look up specific entries in both the web and terminal UI.
I've had issues with a name like node
being too generic. I would have personally gone with page
, or tidbit
(google: a small and particularly interesting item of gossip or information) or the obvious choice: zettel
.
Additionally I think we should have the following tables:
Contains the global settings of the application. I'd suggest storing this in a key-value pair because:
diesel
has a default limit of 32 columns per table. Increasing this massively increases compilation timesqlx
(what we're probably going with) does not have this limitationdefault
implementationkey | value |
---|---|
text, unique | text/json |
Some config settings:
Contains information about the logged in user. The config can determine if the application is in single-user mode or multi-user-mode
id | username | password | last_visited_node |
---|---|---|---|
unique, primary key | text, unique | text | option |
It would be nice if each change to a node is stored as a patch
change in a table. Users can see the history of a node, and (after enabling a checkbox) searching in all histories of all nodes.
node_id | timestamp | patch | user_id |
---|---|---|---|
unique, foreign key | datetime | text | unique, foreign key |
This is mostly implemented and released in 0.1.0.
The thinks that are missing:
After compiling a bit of research about how other zettelkasten implementations structure their databases, I think we can start off with a schema containing three tables, structured as follows:
Nodes
Holds the contents of a node in in the note graph
Columns:
id
Unique, auto-generate primary key for the node, used to reference it in the graphtitle
Title of the nodecontents
Contents of the node, in whatever markup languagecreation time
Time the node was created atmodification time
Time the node was last modified atShould be indexed on title, and full text indexed on contents.
Links
Holds information about the edges of the node graph, or links to external resources (destination should probably be a uri or an enum, I feel like a uri would be more flexible and appropriate here)
nodes.id
nodes.id
Should have an index generated on the
source
field, and probably alsodestination
Aliases
Alternate names that a node can be called by
nodes.id
Should be indexed on the
node
and probably also thetitle
field