move from file storage to sqlite3

This commit is contained in:
2025-01-03 01:00:06 +01:00
parent fbca771479
commit 98655fd1fb
16 changed files with 150 additions and 389 deletions

View File

@@ -0,0 +1,17 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE articles (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title VARCHAR(255) NOT NULL,
sourceUrl VARCHAR(255) NOT NULL UNIQUE,
author VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
publishDate DATETIME NOT NULL,
fetchDate DATETIME NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE articles;
-- +goose StatementEnd

View File

@@ -0,0 +1,10 @@
-- +goose Up
-- +goose StatementBegin
CREATE VIRTUAL TABLE fts_articles USING fts5(id, content);
INSERT INTO fts_articles (id, content) SELECT id, title || '\n' || author || '\n' || content FROM articles;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE fts_articles;
-- +goose StatementEnd