diff --git a/apps/cli/drizzle/0001_awesome_gabe_jones.sql b/apps/cli/drizzle/0001_awesome_gabe_jones.sql new file mode 100644 index 00000000..e9382f5f --- /dev/null +++ b/apps/cli/drizzle/0001_awesome_gabe_jones.sql @@ -0,0 +1 @@ +CREATE INDEX `idx_title_artist_album_albumartist` ON `tracks` (`title`,`artist`,`album`,`album_artist`); \ No newline at end of file diff --git a/apps/cli/drizzle/meta/0001_snapshot.json b/apps/cli/drizzle/meta/0001_snapshot.json new file mode 100644 index 00000000..4daf5f28 --- /dev/null +++ b/apps/cli/drizzle/meta/0001_snapshot.json @@ -0,0 +1,1569 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "a927ee38-ce82-46d0-9494-e75c29248159", + "prevId": "926f883e-c7c5-4c01-b88b-c8f7f649559a", + "tables": { + "album_tracks": { + "name": "album_tracks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "album_tracks_unique_index": { + "name": "album_tracks_unique_index", + "columns": [ + "album_id", + "track_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "album_tracks_album_id_albums_id_fk": { + "name": "album_tracks_album_id_albums_id_fk", + "tableFrom": "album_tracks", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "album_tracks_track_id_tracks_id_fk": { + "name": "album_tracks_track_id_tracks_id_fk", + "tableFrom": "album_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "albums": { + "name": "albums", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artist": { + "name": "artist", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "year": { + "name": "year", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "album_art": { + "name": "album_art", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cid": { + "name": "cid", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artist_uri": { + "name": "artist_uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "apple_music_link": { + "name": "apple_music_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "spotify_link": { + "name": "spotify_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tidal_link": { + "name": "tidal_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "youtube_link": { + "name": "youtube_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "albums_uri_unique": { + "name": "albums_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "albums_cid_unique": { + "name": "albums_cid_unique", + "columns": [ + "cid" + ], + "isUnique": true + }, + "albums_apple_music_link_unique": { + "name": "albums_apple_music_link_unique", + "columns": [ + "apple_music_link" + ], + "isUnique": true + }, + "albums_spotify_link_unique": { + "name": "albums_spotify_link_unique", + "columns": [ + "spotify_link" + ], + "isUnique": true + }, + "albums_tidal_link_unique": { + "name": "albums_tidal_link_unique", + "columns": [ + "tidal_link" + ], + "isUnique": true + }, + "albums_youtube_link_unique": { + "name": "albums_youtube_link_unique", + "columns": [ + "youtube_link" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artist_albums": { + "name": "artist_albums", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "artist_albums_unique_index": { + "name": "artist_albums_unique_index", + "columns": [ + "artist_id", + "album_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artist_albums_artist_id_artists_id_fk": { + "name": "artist_albums_artist_id_artists_id_fk", + "tableFrom": "artist_albums", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "artist_albums_album_id_albums_id_fk": { + "name": "artist_albums_album_id_albums_id_fk", + "tableFrom": "artist_albums", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artist_genres ": { + "name": "artist_genres ", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "genre_id": { + "name": "genre_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "artist_genre_unique_index": { + "name": "artist_genre_unique_index", + "columns": [ + "artist_id", + "genre_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artist_tracks": { + "name": "artist_tracks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "artist_tracks_unique_index": { + "name": "artist_tracks_unique_index", + "columns": [ + "artist_id", + "track_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "artist_tracks_artist_id_artists_id_fk": { + "name": "artist_tracks_artist_id_artists_id_fk", + "tableFrom": "artist_tracks", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "artist_tracks_track_id_tracks_id_fk": { + "name": "artist_tracks_track_id_tracks_id_fk", + "tableFrom": "artist_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "artists": { + "name": "artists", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "biography": { + "name": "biography", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "born": { + "name": "born", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "born_in": { + "name": "born_in", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "died": { + "name": "died", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "picture": { + "name": "picture", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cid": { + "name": "cid", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "apple_music_link": { + "name": "apple_music_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "spotify_link": { + "name": "spotify_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tidal_link": { + "name": "tidal_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "youtube_link": { + "name": "youtube_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "genres": { + "name": "genres", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "artists_uri_unique": { + "name": "artists_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "artists_cid_unique": { + "name": "artists_cid_unique", + "columns": [ + "cid" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "auth_sessions": { + "name": "auth_sessions", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "session": { + "name": "session", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "genres": { + "name": "genres", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "genres_name_unique": { + "name": "genres_name_unique", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "loved_tracks": { + "name": "loved_tracks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "loved_tracks_uri_unique": { + "name": "loved_tracks_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "loved_tracks_unique_index": { + "name": "loved_tracks_unique_index", + "columns": [ + "user_id", + "track_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "loved_tracks_user_id_users_id_fk": { + "name": "loved_tracks_user_id_users_id_fk", + "tableFrom": "loved_tracks", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "loved_tracks_track_id_tracks_id_fk": { + "name": "loved_tracks_track_id_tracks_id_fk", + "tableFrom": "loved_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "scrobbles": { + "name": "scrobbles", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cid": { + "name": "cid", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "timestamp": { + "name": "timestamp", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "scrobbles_uri_unique": { + "name": "scrobbles_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "scrobbles_cid_unique": { + "name": "scrobbles_cid_unique", + "columns": [ + "cid" + ], + "isUnique": true + } + }, + "foreignKeys": { + "scrobbles_user_id_users_id_fk": { + "name": "scrobbles_user_id_users_id_fk", + "tableFrom": "scrobbles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "scrobbles_track_id_tracks_id_fk": { + "name": "scrobbles_track_id_tracks_id_fk", + "tableFrom": "scrobbles", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "scrobbles_album_id_albums_id_fk": { + "name": "scrobbles_album_id_albums_id_fk", + "tableFrom": "scrobbles", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "scrobbles_artist_id_artists_id_fk": { + "name": "scrobbles_artist_id_artists_id_fk", + "tableFrom": "scrobbles", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tracks": { + "name": "tracks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artist": { + "name": "artist", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "album_artist": { + "name": "album_artist", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "album_art": { + "name": "album_art", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "album": { + "name": "album", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_number": { + "name": "track_number", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "mb_id": { + "name": "mb_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "youtube_link": { + "name": "youtube_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "spotify_link": { + "name": "spotify_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "apple_music_link": { + "name": "apple_music_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tidal_link": { + "name": "tidal_link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "disc_number": { + "name": "disc_number", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lyrics": { + "name": "lyrics", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "composer": { + "name": "composer", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "genre": { + "name": "genre", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "copyright_message": { + "name": "copyright_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cid": { + "name": "cid", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "album_uri": { + "name": "album_uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "artist_uri": { + "name": "artist_uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "tracks_mb_id_unique": { + "name": "tracks_mb_id_unique", + "columns": [ + "mb_id" + ], + "isUnique": true + }, + "tracks_youtube_link_unique": { + "name": "tracks_youtube_link_unique", + "columns": [ + "youtube_link" + ], + "isUnique": true + }, + "tracks_spotify_link_unique": { + "name": "tracks_spotify_link_unique", + "columns": [ + "spotify_link" + ], + "isUnique": true + }, + "tracks_apple_music_link_unique": { + "name": "tracks_apple_music_link_unique", + "columns": [ + "apple_music_link" + ], + "isUnique": true + }, + "tracks_tidal_link_unique": { + "name": "tracks_tidal_link_unique", + "columns": [ + "tidal_link" + ], + "isUnique": true + }, + "tracks_uri_unique": { + "name": "tracks_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "tracks_cid_unique": { + "name": "tracks_cid_unique", + "columns": [ + "cid" + ], + "isUnique": true + }, + "idx_title_artist_album_albumartist": { + "name": "idx_title_artist_album_albumartist", + "columns": [ + "title", + "artist", + "album", + "album_artist" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_albums": { + "name": "user_albums", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "scrobbles": { + "name": "scrobbles", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "user_albums_uri_unique": { + "name": "user_albums_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "user_albums_unique_index": { + "name": "user_albums_unique_index", + "columns": [ + "user_id", + "album_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "user_albums_user_id_users_id_fk": { + "name": "user_albums_user_id_users_id_fk", + "tableFrom": "user_albums", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_albums_album_id_albums_id_fk": { + "name": "user_albums_album_id_albums_id_fk", + "tableFrom": "user_albums", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_artists": { + "name": "user_artists", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "scrobbles": { + "name": "scrobbles", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "user_artists_uri_unique": { + "name": "user_artists_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "user_artists_unique_index": { + "name": "user_artists_unique_index", + "columns": [ + "user_id", + "artist_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "user_artists_user_id_users_id_fk": { + "name": "user_artists_user_id_users_id_fk", + "tableFrom": "user_artists", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_artists_artist_id_artists_id_fk": { + "name": "user_artists_artist_id_artists_id_fk", + "tableFrom": "user_artists", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_tracks": { + "name": "user_tracks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "scrobbles": { + "name": "scrobbles", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "user_tracks_uri_unique": { + "name": "user_tracks_uri_unique", + "columns": [ + "uri" + ], + "isUnique": true + }, + "user_tracks_unique_index": { + "name": "user_tracks_unique_index", + "columns": [ + "user_id", + "track_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "user_tracks_user_id_users_id_fk": { + "name": "user_tracks_user_id_users_id_fk", + "tableFrom": "user_tracks", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tracks_track_id_tracks_id_fk": { + "name": "user_tracks_track_id_tracks_id_fk", + "tableFrom": "user_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "did": { + "name": "did", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "handle": { + "name": "handle", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())" + } + }, + "indexes": { + "users_did_unique": { + "name": "users_did_unique", + "columns": [ + "did" + ], + "isUnique": true + }, + "users_handle_unique": { + "name": "users_handle_unique", + "columns": [ + "handle" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/apps/cli/drizzle/meta/_journal.json b/apps/cli/drizzle/meta/_journal.json index 7cfb1c1a..f116d41f 100644 --- a/apps/cli/drizzle/meta/_journal.json +++ b/apps/cli/drizzle/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1768065262210, "tag": "0000_parallel_paper_doll", "breakpoints": true + }, + { + "idx": 1, + "version": "6", + "when": 1768571013590, + "tag": "0001_awesome_gabe_jones", + "breakpoints": true } ] } \ No newline at end of file diff --git a/apps/cli/src/schema/tracks.ts b/apps/cli/src/schema/tracks.ts index dbd1d305..f84f4587 100644 --- a/apps/cli/src/schema/tracks.ts +++ b/apps/cli/src/schema/tracks.ts @@ -1,37 +1,45 @@ import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm"; -import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; +import { integer, sqliteTable, text, index } from "drizzle-orm/sqlite-core"; -const tracks = sqliteTable("tracks", { - id: text("id").primaryKey().notNull(), - title: text("title").notNull(), - artist: text("artist").notNull(), - albumArtist: text("album_artist").notNull(), - albumArt: text("album_art"), - album: text("album").notNull(), - trackNumber: integer("track_number"), - duration: integer("duration").notNull(), - mbId: text("mb_id").unique(), - youtubeLink: text("youtube_link").unique(), - spotifyLink: text("spotify_link").unique(), - appleMusicLink: text("apple_music_link").unique(), - tidalLink: text("tidal_link").unique(), - discNumber: integer("disc_number"), - lyrics: text("lyrics"), - composer: text("composer"), - genre: text("genre"), - label: text("label"), - copyrightMessage: text("copyright_message"), - uri: text("uri").unique(), - cid: text("cid").unique().notNull(), - albumUri: text("album_uri"), - artistUri: text("artist_uri"), - createdAt: integer("created_at", { mode: "timestamp" }) - .notNull() - .default(sql`(unixepoch())`), - updatedAt: integer("updated_at", { mode: "timestamp" }) - .notNull() - .default(sql`(unixepoch())`), -}); +const tracks = sqliteTable( + "tracks", + { + id: text("id").primaryKey().notNull(), + title: text("title").notNull(), + artist: text("artist").notNull(), + albumArtist: text("album_artist").notNull(), + albumArt: text("album_art"), + album: text("album").notNull(), + trackNumber: integer("track_number"), + duration: integer("duration").notNull(), + mbId: text("mb_id").unique(), + youtubeLink: text("youtube_link").unique(), + spotifyLink: text("spotify_link").unique(), + appleMusicLink: text("apple_music_link").unique(), + tidalLink: text("tidal_link").unique(), + discNumber: integer("disc_number"), + lyrics: text("lyrics"), + composer: text("composer"), + genre: text("genre"), + label: text("label"), + copyrightMessage: text("copyright_message"), + uri: text("uri").unique(), + cid: text("cid").unique().notNull(), + albumUri: text("album_uri"), + artistUri: text("artist_uri"), + createdAt: integer("created_at", { mode: "timestamp" }) + .notNull() + .default(sql`(unixepoch())`), + updatedAt: integer("updated_at", { mode: "timestamp" }) + .notNull() + .default(sql`(unixepoch())`), + }, + (t) => ({ + idx_title_artist_album_albumartist: index( + "idx_title_artist_album_albumartist", + ).on(t.title, t.artist, t.album, t.albumArtist), + }), +); export type SelectTrack = InferSelectModel; export type InsertTrack = InferInsertModel;