feat: add cfm model and migration (#43)
* custom fe matter migration * add custom_fe_matter
This commit is contained in:
parent
d702e935b5
commit
f1bc87e3ad
2 changed files with 36 additions and 0 deletions
27
core/models/custom_frontmatter.go
Normal file
27
core/models/custom_frontmatter.go
Normal 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
|
||||
}
|
||||
9
persistence/migrations/004_custom_frontmatter.sql
Normal file
9
persistence/migrations/004_custom_frontmatter.sql
Normal 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);
|
||||
Loading…
Add table
Reference in a new issue