diff --git a/src/store/database/migrations/20260310075859_fts_search/migration.sql b/src/store/database/migrations/20260310075859_fts_search/migration.sql new file mode 100644 index 0000000..1e33cd3 --- /dev/null +++ b/src/store/database/migrations/20260310075859_fts_search/migration.sql @@ -0,0 +1,137 @@ +-- FTS5 virtual tables (external content, no data duplication) +-- unicode61 tokenizer handles accented characters and case-folding automatically + +CREATE VIRTUAL TABLE albums_fts USING fts5( + id UNINDEXED, + name, + album_artist, + content='albums', + content_rowid='rowid', + tokenize='unicode61' +); + +CREATE VIRTUAL TABLE tracks_fts USING fts5( + id UNINDEXED, + name, + album, + album_artist, + content='tracks', + content_rowid='rowid', + tokenize='unicode61' +); + +CREATE VIRTUAL TABLE artists_fts USING fts5( + id UNINDEXED, + name, + content='artists', + content_rowid='rowid', + tokenize='unicode61' +); + +CREATE VIRTUAL TABLE playlists_fts USING fts5( + id UNINDEXED, + name, + content='playlists', + content_rowid='rowid', + tokenize='unicode61' +); + +--> statement-breakpoint + +-- Sync triggers: albums + +CREATE TRIGGER albums_fts_ai AFTER INSERT ON albums BEGIN + INSERT INTO albums_fts(rowid, id, name, album_artist) + VALUES (new.rowid, new.id, new.name, new.album_artist); +END; + +CREATE TRIGGER albums_fts_ad AFTER DELETE ON albums BEGIN + INSERT INTO albums_fts(albums_fts, rowid, id, name, album_artist) + VALUES ('delete', old.rowid, old.id, old.name, old.album_artist); +END; + +CREATE TRIGGER albums_fts_au AFTER UPDATE ON albums BEGIN + INSERT INTO albums_fts(albums_fts, rowid, id, name, album_artist) + VALUES ('delete', old.rowid, old.id, old.name, old.album_artist); + INSERT INTO albums_fts(rowid, id, name, album_artist) + VALUES (new.rowid, new.id, new.name, new.album_artist); +END; + +--> statement-breakpoint + +-- Sync triggers: tracks + +CREATE TRIGGER tracks_fts_ai AFTER INSERT ON tracks BEGIN + INSERT INTO tracks_fts(rowid, id, name, album, album_artist) + VALUES (new.rowid, new.id, new.name, new.album, new.album_artist); +END; + +CREATE TRIGGER tracks_fts_ad AFTER DELETE ON tracks BEGIN + INSERT INTO tracks_fts(tracks_fts, rowid, id, name, album, album_artist) + VALUES ('delete', old.rowid, old.id, old.name, old.album, old.album_artist); +END; + +CREATE TRIGGER tracks_fts_au AFTER UPDATE ON tracks BEGIN + INSERT INTO tracks_fts(tracks_fts, rowid, id, name, album, album_artist) + VALUES ('delete', old.rowid, old.id, old.name, old.album, old.album_artist); + INSERT INTO tracks_fts(rowid, id, name, album, album_artist) + VALUES (new.rowid, new.id, new.name, new.album, new.album_artist); +END; + +--> statement-breakpoint + +-- Sync triggers: artists + +CREATE TRIGGER artists_fts_ai AFTER INSERT ON artists BEGIN + INSERT INTO artists_fts(rowid, id, name) + VALUES (new.rowid, new.id, new.name); +END; + +CREATE TRIGGER artists_fts_ad AFTER DELETE ON artists BEGIN + INSERT INTO artists_fts(artists_fts, rowid, id, name) + VALUES ('delete', old.rowid, old.id, old.name); +END; + +CREATE TRIGGER artists_fts_au AFTER UPDATE ON artists BEGIN + INSERT INTO artists_fts(artists_fts, rowid, id, name) + VALUES ('delete', old.rowid, old.id, old.name); + INSERT INTO artists_fts(rowid, id, name) + VALUES (new.rowid, new.id, new.name); +END; + +--> statement-breakpoint + +-- Sync triggers: playlists + +CREATE TRIGGER playlists_fts_ai AFTER INSERT ON playlists BEGIN + INSERT INTO playlists_fts(rowid, id, name) + VALUES (new.rowid, new.id, new.name); +END; + +CREATE TRIGGER playlists_fts_ad AFTER DELETE ON playlists BEGIN + INSERT INTO playlists_fts(playlists_fts, rowid, id, name) + VALUES ('delete', old.rowid, old.id, old.name); +END; + +CREATE TRIGGER playlists_fts_au AFTER UPDATE ON playlists BEGIN + INSERT INTO playlists_fts(playlists_fts, rowid, id, name) + VALUES ('delete', old.rowid, old.id, old.name); + INSERT INTO playlists_fts(rowid, id, name) + VALUES (new.rowid, new.id, new.name); +END; + +--> statement-breakpoint + +-- Backfill existing data + +INSERT INTO albums_fts(rowid, id, name, album_artist) +SELECT rowid, id, name, album_artist FROM albums; + +INSERT INTO tracks_fts(rowid, id, name, album, album_artist) +SELECT rowid, id, name, album, album_artist FROM tracks; + +INSERT INTO artists_fts(rowid, id, name) +SELECT rowid, id, name FROM artists; + +INSERT INTO playlists_fts(rowid, id, name) +SELECT rowid, id, name FROM playlists; \ No newline at end of file diff --git a/src/store/database/migrations/20260310075859_fts_search/snapshot.json b/src/store/database/migrations/20260310075859_fts_search/snapshot.json new file mode 100644 index 0000000..5ddd7d0 --- /dev/null +++ b/src/store/database/migrations/20260310075859_fts_search/snapshot.json @@ -0,0 +1,1652 @@ +{ + "id": "abc1c8be-8299-41f4-a802-803db8264230", + "prevIds": [ + "9d68fc46-9d2a-4d44-8fa1-95af839b1555" + ], + "version": "7", + "dialect": "sqlite", + "ddl": [ + { + "name": "album_artists", + "entityType": "tables" + }, + { + "name": "album_similar", + "entityType": "tables" + }, + { + "name": "albums", + "entityType": "tables" + }, + { + "name": "artists", + "entityType": "tables" + }, + { + "name": "downloads", + "entityType": "tables" + }, + { + "name": "playlist_tracks", + "entityType": "tables" + }, + { + "name": "playlists", + "entityType": "tables" + }, + { + "name": "search_queries", + "entityType": "tables" + }, + { + "name": "settings", + "entityType": "tables" + }, + { + "name": "sleep_timer", + "entityType": "tables" + }, + { + "name": "sources", + "entityType": "tables" + }, + { + "name": "sync_cursors", + "entityType": "tables" + }, + { + "name": "track_artists", + "entityType": "tables" + }, + { + "name": "tracks", + "entityType": "tables" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "album_artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "album_id", + "entityType": "columns", + "table": "album_artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "artist_id", + "entityType": "columns", + "table": "album_artists" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "order_index", + "entityType": "columns", + "table": "album_artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "album_similar" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "album_id", + "entityType": "columns", + "table": "album_similar" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "similar_album_id", + "entityType": "columns", + "table": "album_similar" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "albums" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "albums" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "albums" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "production_year", + "entityType": "columns", + "table": "albums" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "album_artist", + "entityType": "columns", + "table": "albums" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "metadata", + "entityType": "columns", + "table": "albums" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "first_synced_at", + "entityType": "columns", + "table": "albums" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_synced_at", + "entityType": "columns", + "table": "albums" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "albums" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "albums" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "artists" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "artists" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "metadata", + "entityType": "columns", + "table": "artists" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "first_synced_at", + "entityType": "columns", + "table": "artists" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_synced_at", + "entityType": "columns", + "table": "artists" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "artists" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "hash", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "filename", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "artwork_path", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "mimetype", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "file_size", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "progress", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "is_failed", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "is_complete", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "metadata", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "downloads" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "playlist_tracks" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "playlist_id", + "entityType": "columns", + "table": "playlist_tracks" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "track_id", + "entityType": "columns", + "table": "playlist_tracks" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "position", + "entityType": "columns", + "table": "playlist_tracks" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "can_delete", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "child_count", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "metadata", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "first_synced_at", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_synced_at", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "playlists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "search_queries" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "search_queries" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "query", + "entityType": "columns", + "table": "search_queries" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "local_playback_only", + "entityType": "columns", + "table": "search_queries" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "metadata", + "entityType": "columns", + "table": "search_queries" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "search_queries" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "search_queries" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "settings" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bitrate", + "entityType": "columns", + "table": "settings" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "is_onboarding_complete", + "entityType": "columns", + "table": "settings" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "has_received_error_reporting_alert", + "entityType": "columns", + "table": "settings" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "enable_playback_reporting", + "entityType": "columns", + "table": "settings" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "color_scheme", + "entityType": "columns", + "table": "settings" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "settings" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "settings" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "sleep_timer" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "date", + "entityType": "columns", + "table": "sleep_timer" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "sleep_timer" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "sleep_timer" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "sources" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "uri", + "entityType": "columns", + "table": "sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "access_token", + "entityType": "columns", + "table": "sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "device_id", + "entityType": "columns", + "table": "sources" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "type", + "entityType": "columns", + "table": "sources" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "sources" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "sources" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "entity_type", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": "''", + "generated": null, + "name": "parent_entity_id", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": "''", + "generated": null, + "name": "parent_entity_type", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "start_index", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "page_size", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "completed", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "attempts", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "failed_at", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_error", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "sync_cursors" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "track_artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "track_id", + "entityType": "columns", + "table": "track_artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "artist_id", + "entityType": "columns", + "table": "track_artists" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "order_index", + "entityType": "columns", + "table": "track_artists" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "album_id", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "album", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "album_artist", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "production_year", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "index_number", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "parent_index_number", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "run_time_ticks", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "lyrics", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "metadata", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "first_synced_at", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_synced_at", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "tracks" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "tracks" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_album_artists_source_id_sources_id_fk", + "entityType": "fks", + "table": "album_artists" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_album_similar_source_id_sources_id_fk", + "entityType": "fks", + "table": "album_similar" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_albums_source_id_sources_id_fk", + "entityType": "fks", + "table": "albums" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_artists_source_id_sources_id_fk", + "entityType": "fks", + "table": "artists" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_downloads_source_id_sources_id_fk", + "entityType": "fks", + "table": "downloads" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_playlist_tracks_source_id_sources_id_fk", + "entityType": "fks", + "table": "playlist_tracks" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_playlists_source_id_sources_id_fk", + "entityType": "fks", + "table": "playlists" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_search_queries_source_id_sources_id_fk", + "entityType": "fks", + "table": "search_queries" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_sync_cursors_source_id_sources_id_fk", + "entityType": "fks", + "table": "sync_cursors" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_track_artists_source_id_sources_id_fk", + "entityType": "fks", + "table": "track_artists" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_tracks_source_id_sources_id_fk", + "entityType": "fks", + "table": "tracks" + }, + { + "columns": [ + "source_id", + "album_id", + "artist_id" + ], + "nameExplicit": false, + "name": "album_artists_pk", + "entityType": "pks", + "table": "album_artists" + }, + { + "columns": [ + "source_id", + "album_id", + "similar_album_id" + ], + "nameExplicit": false, + "name": "album_similar_pk", + "entityType": "pks", + "table": "album_similar" + }, + { + "columns": [ + "source_id", + "playlist_id", + "track_id" + ], + "nameExplicit": false, + "name": "playlist_tracks_pk", + "entityType": "pks", + "table": "playlist_tracks" + }, + { + "columns": [ + "source_id", + "entity_type", + "parent_entity_id" + ], + "nameExplicit": false, + "name": "sync_cursors_pk", + "entityType": "pks", + "table": "sync_cursors" + }, + { + "columns": [ + "source_id", + "track_id", + "artist_id" + ], + "nameExplicit": false, + "name": "track_artists_pk", + "entityType": "pks", + "table": "track_artists" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "albums_pk", + "table": "albums", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "artists_pk", + "table": "artists", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "downloads_pk", + "table": "downloads", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "playlists_pk", + "table": "playlists", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "search_queries_pk", + "table": "search_queries", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "settings_pk", + "table": "settings", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "sleep_timer_pk", + "table": "sleep_timer", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "sources_pk", + "table": "sources", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "tracks_pk", + "table": "tracks", + "entityType": "pks" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "artist_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "album_artists_source_artist_idx", + "entityType": "indexes", + "table": "album_artists" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "name", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "albums_source_name_idx", + "entityType": "indexes", + "table": "albums" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "production_year", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "albums_source_year_idx", + "entityType": "indexes", + "table": "albums" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "name", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "artists_source_name_idx", + "entityType": "indexes", + "table": "artists" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "playlist_id", + "isExpression": false + }, + { + "value": "position", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "playlist_tracks_source_playlist_position_idx", + "entityType": "indexes", + "table": "playlist_tracks" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "name", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "playlists_source_name_idx", + "entityType": "indexes", + "table": "playlists" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "search_queries_source_timestamp_idx", + "entityType": "indexes", + "table": "search_queries" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "artist_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "track_artists_source_artist_idx", + "entityType": "indexes", + "table": "track_artists" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "album_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "tracks_source_album_idx", + "entityType": "indexes", + "table": "tracks" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + }, + { + "value": "name", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "tracks_source_name_idx", + "entityType": "indexes", + "table": "tracks" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/src/store/database/migrations/migrations.js b/src/store/database/migrations/migrations.js index 144029b..e5bfc5d 100644 --- a/src/store/database/migrations/migrations.js +++ b/src/store/database/migrations/migrations.js @@ -1,10 +1,9 @@ -// This file is required for Expo/React Native SQLite migrations - https://orm.drizzle.team/quick-sqlite/expo +import m0000 from "./20260308083649_strong_johnny_storm/migration.sql"; +import m0001 from "./20260310075859_fts_search/migration.sql"; -import m0000 from './20260308083649_strong_johnny_storm/migration.sql'; - - export default { +export default { migrations: { - "20260308083649_strong_johnny_storm": m0000 -} - } - \ No newline at end of file + "20260308083649_strong_johnny_storm": m0000, + "20260310075859_fts_search": m0001, + }, +};