feat: add cfm model and migration (#43)

* custom fe matter migration

* add custom_fe_matter
This commit is contained in:
Kristian 2026-05-30 13:12:22 +02:00 committed by GitHub
parent d702e935b5
commit f1bc87e3ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View file

@ -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
}

View file

@ -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);