diff options
| author | ivar <i@oiee.no> | 2026-04-04 16:07:08 +0200 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2026-04-04 16:07:08 +0200 |
| commit | 3b3ca0ce18ed13fca9a7f81229ba0b05957afab0 (patch) | |
| tree | 44aeb7a39569f0e4fd34c6da196d575c1a23c622 /internal | |
| parent | 41c0f3e592c2140c8ad26ce5d91010399679ee8d (diff) | |
| download | nebbet.no-3b3ca0ce18ed13fca9a7f81229ba0b05957afab0.tar.xz nebbet.no-3b3ca0ce18ed13fca9a7f81229ba0b05957afab0.zip | |
feat: add redirects table to meta.db schema
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/db/meta.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/db/meta.go b/internal/db/meta.go index dd05764..87d4fbf 100644 --- a/internal/db/meta.go +++ b/internal/db/meta.go @@ -39,6 +39,22 @@ func OpenMeta(path string) (*MetaDB, error) { ); CREATE INDEX IF NOT EXISTS idx_pages_path ON pages(path); CREATE INDEX IF NOT EXISTS idx_pages_date ON pages(date); + CREATE TABLE IF NOT EXISTS posts ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + slug TEXT NOT NULL UNIQUE, + title TEXT NOT NULL DEFAULT '', + date TEXT DEFAULT '', + tags TEXT DEFAULT '[]', + draft INTEGER NOT NULL DEFAULT 0, + blocks TEXT NOT NULL DEFAULT '[]', + updated_at INTEGER NOT NULL DEFAULT (cast(strftime('%s','now') * 1000000 as integer)) + ); + CREATE INDEX IF NOT EXISTS idx_posts_slug ON posts(slug); + CREATE INDEX IF NOT EXISTS idx_posts_date ON posts(date); + CREATE TABLE IF NOT EXISTS redirects ( + from_slug TEXT PRIMARY KEY, + to_slug TEXT NOT NULL + ); `) if err != nil { return nil, err |
