Upgrade database schema to version 2 and remove unused meta_* columns

- Increment `SCHEMA_VERSION` to 2 in `schema.ts`.
- Remove all `meta_*` columns from database tables.
- Add migration logic to handle schema upgrades and clean up unused columns.
- Modify database models and repository methods to exclude `meta_*` fields for stricter typings and improved structure.
- Refactor and optimize query statements across repositories to align with new schema changes.
This commit is contained in:
natreex
2025-11-26 19:17:40 -05:00
parent 736b9a3609
commit 9648d9e9be
13 changed files with 178 additions and 131 deletions

View File

@@ -4,9 +4,9 @@ import Chapter from '../database/models/Chapter.js';
import type { ChapterProps, CompanionContent, ActStory } from '../database/models/Chapter.js';
interface GetWholeChapterData {
chapterId: string;
id: string;
version: number;
bookId?: string;
bookid: string;
}
interface SaveChapterContentData {
@@ -53,7 +53,7 @@ ipcMain.handle('db:book:chapters', createHandler<string, ChapterProps[]>(
// GET /chapter/whole - Get whole chapter
ipcMain.handle('db:chapter:whole', createHandler<GetWholeChapterData, ChapterProps>(
function(userId: string, data: GetWholeChapterData, lang: 'fr' | 'en'): ChapterProps {
return Chapter.getWholeChapter(userId, data.chapterId, data.version, data.bookId, lang);
return Chapter.getWholeChapter(userId, data.id, data.version, data.bookid, lang);
}
)
);