mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
feat(storage): add SQLite-backed m3u playlists for Electron with IndexedDB migration
This commit is contained in:
1 parent
129848c4d4
commit
086eab9306
9 files changed
+780
-185
No files matched your search
@@ -56,7 +56,20 @@ const CREATE_TABLE_STATEMENTS = [
|
||||
autoRefresh INTEGER DEFAULT 0,
|
||||
macAddress TEXT,
|
||||
url TEXT,
|
||||
portal_url TEXT,
|
||||
count INTEGER,
|
||||
import_date TEXT,
|
||||
update_date INTEGER,
|
||||
position INTEGER,
|
||||
favorites TEXT,
|
||||
recently_viewed TEXT,
|
||||
payload TEXT,
|
||||
last_usage TEXT
|
||||
)`,
|
||||
`CREATE TABLE IF NOT EXISTS app_state (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT NOT NULL,
|
||||
updated_at TEXT DEFAULT (datetime('now'))
|
||||
)`,
|
||||
`CREATE TABLE IF NOT EXISTS categories (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -209,6 +222,15 @@ const CREATE_TABLE_STATEMENTS = [
|
||||
const MIGRATION_STATEMENTS = [
|
||||
// v1.0.0 -> v1.1.0: Add hidden column to categories for category management
|
||||
`ALTER TABLE categories ADD COLUMN hidden INTEGER DEFAULT 0`,
|
||||
// v1.1.0 -> v1.2.0: Add playlist metadata/payload columns for M3U + unified playlist persistence
|
||||
`ALTER TABLE playlists ADD COLUMN portal_url TEXT`,
|
||||
`ALTER TABLE playlists ADD COLUMN count INTEGER`,
|
||||
`ALTER TABLE playlists ADD COLUMN import_date TEXT`,
|
||||
`ALTER TABLE playlists ADD COLUMN update_date INTEGER`,
|
||||
`ALTER TABLE playlists ADD COLUMN position INTEGER`,
|
||||
`ALTER TABLE playlists ADD COLUMN favorites TEXT`,
|
||||
`ALTER TABLE playlists ADD COLUMN recently_viewed TEXT`,
|
||||
`ALTER TABLE playlists ADD COLUMN payload TEXT`,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,9 +35,24 @@ export const playlists = sqliteTable('playlists', {
|
||||
autoRefresh: integer('autoRefresh', { mode: 'boolean' }).default(false),
|
||||
macAddress: text('macAddress'),
|
||||
url: text('url'),
|
||||
portalUrl: text('portal_url'),
|
||||
count: integer('count'),
|
||||
importDate: text('import_date'),
|
||||
updateDate: integer('update_date'),
|
||||
position: integer('position'),
|
||||
favorites: text('favorites'),
|
||||
recentlyViewed: text('recently_viewed'),
|
||||
payload: text('payload'),
|
||||
lastUsage: text('last_usage'),
|
||||
});
|
||||
|
||||
// App key-value state table (e.g. one-time migration flags)
|
||||
export const appState = sqliteTable('app_state', {
|
||||
key: text('key').primaryKey(),
|
||||
value: text('value').notNull(),
|
||||
updatedAt: text('updated_at').default(sql`CURRENT_TIMESTAMP`),
|
||||
});
|
||||
|
||||
// Categories table
|
||||
export const categories = sqliteTable(
|
||||
'categories',
|
||||
@@ -214,6 +229,8 @@ export const playbackPositions = sqliteTable(
|
||||
// Type exports for TypeScript
|
||||
export type Playlist = typeof playlists.$inferSelect;
|
||||
export type NewPlaylist = typeof playlists.$inferInsert;
|
||||
export type AppState = typeof appState.$inferSelect;
|
||||
export type NewAppState = typeof appState.$inferInsert;
|
||||
|
||||
export type Category = typeof categories.$inferSelect;
|
||||
export type NewCategory = typeof categories.$inferInsert;
|
||||
|
||||
Reference in new issue
Block a user