refactor: improve database initialization and news fetching structure

This commit is contained in:
2025-08-01 21:57:13 +02:00
parent 3a1c817381
commit e22f3a627a
8 changed files with 552 additions and 400 deletions

File diff suppressed because it is too large Load Diff

34
backend/app/schema.sql Normal file
View File

@@ -0,0 +1,34 @@
-- Database schema for Owly News Summariser
-- News table to store articles
CREATE TABLE IF NOT EXISTS news (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
description TEXT,
url TEXT NOT NULL,
published TIMESTAMP NOT NULL,
country TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Index for faster queries on published date
CREATE INDEX IF NOT EXISTS idx_news_published ON news(published);
-- Feeds table to store RSS feed sources
CREATE TABLE IF NOT EXISTS feeds (
id INTEGER PRIMARY KEY,
country TEXT,
url TEXT UNIQUE NOT NULL
);
-- Settings table for application configuration
CREATE TABLE IF NOT EXISTS settings (
key TEXT PRIMARY KEY,
val TEXT NOT NULL
);
-- Meta table for application metadata
CREATE TABLE IF NOT EXISTS meta (
key TEXT PRIMARY KEY,
val TEXT NOT NULL
);