diff --git a/core/models/custom_frontmatter.go b/core/models/custom_frontmatter.go new file mode 100644 index 0000000..69f8dab --- /dev/null +++ b/core/models/custom_frontmatter.go @@ -0,0 +1,27 @@ +package models + +type CustomFronMatter struct { + nodeID string + key string + value string +} + +func NewCustomFrontMatter(nodeID, key, value string) *CustomFronMatter { + return &CustomFronMatter{ + nodeID: nodeID, + key: key, + value: value, + } +} + +func (cfm *CustomFronMatter) NodeID() string { + return cfm.nodeID +} + +func (cfm *CustomFronMatter) Key() string { + return cfm.key +} + +func (cfm *CustomFronMatter) Value() string { + return cfm.value +} diff --git a/persistence/migrations/004_custom_frontmatter.sql b/persistence/migrations/004_custom_frontmatter.sql new file mode 100644 index 0000000..30fb316 --- /dev/null +++ b/persistence/migrations/004_custom_frontmatter.sql @@ -0,0 +1,9 @@ +CREATE TABLE custom_frontmatter( + note_id TEXT, + key TEXT, + value TEXT, + PRIMARY KEY (note_id, key, value), + FOREIGN KEY (note_id) REFERENCES note(id) ON DELETE CASCADE +); + +CREATE INDEX IF NOT EXISTS idx_cfe_key_value on custom_frontmatter(key, value);