feat: more cleanup work in UI

This commit is contained in:
2026-02-10 15:24:36 +01:00
parent 46970de656
commit 0a6710b684
22 changed files with 1945 additions and 461 deletions

View File

@@ -149,7 +149,12 @@ export class DatabaseConnection {
synced_at INTEGER,
checksum TEXT,
tags TEXT,
categories TEXT
categories TEXT,
published_title TEXT,
published_content TEXT,
published_tags TEXT,
published_categories TEXT,
published_excerpt TEXT
);
CREATE TABLE IF NOT EXISTS media (
@@ -242,6 +247,18 @@ export class DatabaseConnection {
);
}
// Migration: Add published snapshot columns for discard functionality
const publishedContentCol = await this.localClient.execute(
"SELECT name FROM pragma_table_info('posts') WHERE name = 'published_content'"
);
if (publishedContentCol.rows.length === 0) {
await this.localClient.execute("ALTER TABLE posts ADD COLUMN published_title TEXT");
await this.localClient.execute("ALTER TABLE posts ADD COLUMN published_content TEXT");
await this.localClient.execute("ALTER TABLE posts ADD COLUMN published_tags TEXT");
await this.localClient.execute("ALTER TABLE posts ADD COLUMN published_categories TEXT");
await this.localClient.execute("ALTER TABLE posts ADD COLUMN published_excerpt TEXT");
}
// Create FTS5 virtual table for full-text search
await this.localClient.execute(`
CREATE VIRTUAL TABLE IF NOT EXISTS posts_fts USING fts5(

View File

@@ -29,6 +29,12 @@ export const posts = sqliteTable('posts', {
checksum: text('checksum'),
tags: text('tags'), // JSON array stored as text
categories: text('categories'), // JSON array stored as text
// Published snapshot - stores the last published version for discard functionality
publishedTitle: text('published_title'),
publishedContent: text('published_content'),
publishedTags: text('published_tags'), // JSON array stored as text
publishedCategories: text('published_categories'), // JSON array stored as text
publishedExcerpt: text('published_excerpt'),
});
// Media table - stores metadata for images and other media