@rocksky/cli 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -11
- package/dist/drizzle/0000_parallel_paper_doll.sql +220 -0
- package/dist/drizzle/0001_awesome_gabe_jones.sql +1 -0
- package/dist/drizzle/meta/0000_snapshot.json +1559 -0
- package/dist/drizzle/meta/0001_snapshot.json +1569 -0
- package/dist/drizzle/meta/_journal.json +20 -0
- package/dist/index.js +8509 -254
- package/drizzle/0000_parallel_paper_doll.sql +220 -0
- package/drizzle/0001_awesome_gabe_jones.sql +1 -0
- package/drizzle/meta/0000_snapshot.json +1559 -0
- package/drizzle/meta/0001_snapshot.json +1569 -0
- package/drizzle/meta/_journal.json +20 -0
- package/drizzle.config.ts +18 -0
- package/package.json +35 -3
- package/src/client.ts +32 -14
- package/src/cmd/scrobble-api.ts +465 -0
- package/src/cmd/scrobble.ts +14 -61
- package/src/cmd/search.ts +27 -25
- package/src/cmd/sync.ts +1085 -0
- package/src/cmd/whoami.ts +36 -7
- package/src/context.ts +24 -0
- package/src/drizzle.ts +53 -0
- package/src/index.ts +66 -26
- package/src/jetstream.ts +285 -0
- package/src/lexicon/index.ts +1321 -0
- package/src/lexicon/lexicons.ts +5453 -0
- package/src/lexicon/types/app/bsky/actor/profile.ts +38 -0
- package/src/lexicon/types/app/rocksky/actor/defs.ts +146 -0
- package/src/lexicon/types/app/rocksky/actor/getActorAlbums.ts +56 -0
- package/src/lexicon/types/app/rocksky/actor/getActorArtists.ts +56 -0
- package/src/lexicon/types/app/rocksky/actor/getActorCompatibility.ts +48 -0
- package/src/lexicon/types/app/rocksky/actor/getActorLovedSongs.ts +52 -0
- package/src/lexicon/types/app/rocksky/actor/getActorNeighbours.ts +48 -0
- package/src/lexicon/types/app/rocksky/actor/getActorPlaylists.ts +52 -0
- package/src/lexicon/types/app/rocksky/actor/getActorScrobbles.ts +52 -0
- package/src/lexicon/types/app/rocksky/actor/getActorSongs.ts +56 -0
- package/src/lexicon/types/app/rocksky/actor/getProfile.ts +43 -0
- package/src/lexicon/types/app/rocksky/album/defs.ts +85 -0
- package/src/lexicon/types/app/rocksky/album/getAlbum.ts +43 -0
- package/src/lexicon/types/app/rocksky/album/getAlbumTracks.ts +48 -0
- package/src/lexicon/types/app/rocksky/album/getAlbums.ts +50 -0
- package/src/lexicon/types/app/rocksky/album.ts +51 -0
- package/src/lexicon/types/app/rocksky/apikey/createApikey.ts +51 -0
- package/src/lexicon/types/app/rocksky/apikey/defs.ts +31 -0
- package/src/lexicon/types/app/rocksky/apikey/getApikeys.ts +50 -0
- package/src/lexicon/types/app/rocksky/apikey/removeApikey.ts +43 -0
- package/src/lexicon/types/app/rocksky/apikey/updateApikey.ts +53 -0
- package/src/lexicon/types/app/rocksky/apikeys/defs.ts +7 -0
- package/src/lexicon/types/app/rocksky/artist/defs.ts +140 -0
- package/src/lexicon/types/app/rocksky/artist/getArtist.ts +43 -0
- package/src/lexicon/types/app/rocksky/artist/getArtistAlbums.ts +48 -0
- package/src/lexicon/types/app/rocksky/artist/getArtistListeners.ts +52 -0
- package/src/lexicon/types/app/rocksky/artist/getArtistTracks.ts +52 -0
- package/src/lexicon/types/app/rocksky/artist/getArtists.ts +52 -0
- package/src/lexicon/types/app/rocksky/artist.ts +41 -0
- package/src/lexicon/types/app/rocksky/charts/defs.ts +44 -0
- package/src/lexicon/types/app/rocksky/charts/getScrobblesChart.ts +49 -0
- package/src/lexicon/types/app/rocksky/dropbox/defs.ts +71 -0
- package/src/lexicon/types/app/rocksky/dropbox/downloadFile.ts +42 -0
- package/src/lexicon/types/app/rocksky/dropbox/getFiles.ts +43 -0
- package/src/lexicon/types/app/rocksky/dropbox/getMetadata.ts +43 -0
- package/src/lexicon/types/app/rocksky/dropbox/getTemporaryLink.ts +43 -0
- package/src/lexicon/types/app/rocksky/feed/defs.ts +182 -0
- package/src/lexicon/types/app/rocksky/feed/describeFeedGenerator.ts +48 -0
- package/src/lexicon/types/app/rocksky/feed/generator.ts +29 -0
- package/src/lexicon/types/app/rocksky/feed/getFeed.ts +47 -0
- package/src/lexicon/types/app/rocksky/feed/getFeedGenerator.ts +48 -0
- package/src/lexicon/types/app/rocksky/feed/getFeedGenerators.ts +43 -0
- package/src/lexicon/types/app/rocksky/feed/getFeedSkeleton.ts +56 -0
- package/src/lexicon/types/app/rocksky/feed/getNowPlayings.ts +43 -0
- package/src/lexicon/types/app/rocksky/feed/search.ts +43 -0
- package/src/lexicon/types/app/rocksky/googledrive/defs.ts +42 -0
- package/src/lexicon/types/app/rocksky/googledrive/downloadFile.ts +42 -0
- package/src/lexicon/types/app/rocksky/googledrive/getFile.ts +43 -0
- package/src/lexicon/types/app/rocksky/googledrive/getFiles.ts +43 -0
- package/src/lexicon/types/app/rocksky/graph/defs.ts +47 -0
- package/src/lexicon/types/app/rocksky/graph/follow.ts +28 -0
- package/src/lexicon/types/app/rocksky/graph/followAccount.ts +50 -0
- package/src/lexicon/types/app/rocksky/graph/getFollowers.ts +56 -0
- package/src/lexicon/types/app/rocksky/graph/getFollows.ts +56 -0
- package/src/lexicon/types/app/rocksky/graph/getKnownFollowers.ts +52 -0
- package/src/lexicon/types/app/rocksky/graph/unfollowAccount.ts +50 -0
- package/src/lexicon/types/app/rocksky/like/dislikeShout.ts +49 -0
- package/src/lexicon/types/app/rocksky/like/dislikeSong.ts +49 -0
- package/src/lexicon/types/app/rocksky/like/likeShout.ts +49 -0
- package/src/lexicon/types/app/rocksky/like/likeSong.ts +49 -0
- package/src/lexicon/types/app/rocksky/like.ts +27 -0
- package/src/lexicon/types/app/rocksky/player/addDirectoryToQueue.ts +40 -0
- package/src/lexicon/types/app/rocksky/player/addItemsToQueue.ts +39 -0
- package/src/lexicon/types/app/rocksky/player/defs.ts +57 -0
- package/src/lexicon/types/app/rocksky/player/getCurrentlyPlaying.ts +44 -0
- package/src/lexicon/types/app/rocksky/player/getPlaybackQueue.ts +42 -0
- package/src/lexicon/types/app/rocksky/player/next.ts +34 -0
- package/src/lexicon/types/app/rocksky/player/pause.ts +34 -0
- package/src/lexicon/types/app/rocksky/player/play.ts +34 -0
- package/src/lexicon/types/app/rocksky/player/playDirectory.ts +38 -0
- package/src/lexicon/types/app/rocksky/player/playFile.ts +35 -0
- package/src/lexicon/types/app/rocksky/player/previous.ts +34 -0
- package/src/lexicon/types/app/rocksky/player/seek.ts +36 -0
- package/src/lexicon/types/app/rocksky/playlist/createPlaylist.ts +37 -0
- package/src/lexicon/types/app/rocksky/playlist/defs.ts +86 -0
- package/src/lexicon/types/app/rocksky/playlist/getPlaylist.ts +43 -0
- package/src/lexicon/types/app/rocksky/playlist/getPlaylists.ts +50 -0
- package/src/lexicon/types/app/rocksky/playlist/insertDirectory.ts +39 -0
- package/src/lexicon/types/app/rocksky/playlist/insertFiles.ts +38 -0
- package/src/lexicon/types/app/rocksky/playlist/removePlaylist.ts +35 -0
- package/src/lexicon/types/app/rocksky/playlist/removeTrack.ts +37 -0
- package/src/lexicon/types/app/rocksky/playlist/startPlaylist.ts +39 -0
- package/src/lexicon/types/app/rocksky/playlist.ts +43 -0
- package/src/lexicon/types/app/rocksky/radio/defs.ts +63 -0
- package/src/lexicon/types/app/rocksky/radio.ts +37 -0
- package/src/lexicon/types/app/rocksky/scrobble/createScrobble.ts +91 -0
- package/src/lexicon/types/app/rocksky/scrobble/defs.ts +93 -0
- package/src/lexicon/types/app/rocksky/scrobble/getScrobble.ts +43 -0
- package/src/lexicon/types/app/rocksky/scrobble/getScrobbles.ts +54 -0
- package/src/lexicon/types/app/rocksky/scrobble.ts +75 -0
- package/src/lexicon/types/app/rocksky/shout/createShout.ts +49 -0
- package/src/lexicon/types/app/rocksky/shout/defs.ts +58 -0
- package/src/lexicon/types/app/rocksky/shout/getAlbumShouts.ts +52 -0
- package/src/lexicon/types/app/rocksky/shout/getArtistShouts.ts +52 -0
- package/src/lexicon/types/app/rocksky/shout/getProfileShouts.ts +52 -0
- package/src/lexicon/types/app/rocksky/shout/getShoutReplies.ts +52 -0
- package/src/lexicon/types/app/rocksky/shout/getTrackShouts.ts +48 -0
- package/src/lexicon/types/app/rocksky/shout/removeShout.ts +43 -0
- package/src/lexicon/types/app/rocksky/shout/replyShout.ts +51 -0
- package/src/lexicon/types/app/rocksky/shout/reportShout.ts +51 -0
- package/src/lexicon/types/app/rocksky/shout.ts +30 -0
- package/src/lexicon/types/app/rocksky/song/createSong.ts +71 -0
- package/src/lexicon/types/app/rocksky/song/defs.ts +103 -0
- package/src/lexicon/types/app/rocksky/song/getSong.ts +43 -0
- package/src/lexicon/types/app/rocksky/song/getSongs.ts +50 -0
- package/src/lexicon/types/app/rocksky/song.ts +74 -0
- package/src/lexicon/types/app/rocksky/spotify/defs.ts +35 -0
- package/src/lexicon/types/app/rocksky/spotify/getCurrentlyPlaying.ts +43 -0
- package/src/lexicon/types/app/rocksky/spotify/next.ts +32 -0
- package/src/lexicon/types/app/rocksky/spotify/pause.ts +32 -0
- package/src/lexicon/types/app/rocksky/spotify/play.ts +32 -0
- package/src/lexicon/types/app/rocksky/spotify/previous.ts +32 -0
- package/src/lexicon/types/app/rocksky/spotify/seek.ts +35 -0
- package/src/lexicon/types/app/rocksky/stats/defs.ts +33 -0
- package/src/lexicon/types/app/rocksky/stats/getStats.ts +43 -0
- package/src/lexicon/types/com/atproto/repo/strongRef.ts +26 -0
- package/src/lexicon/util.ts +13 -0
- package/src/lib/agent.ts +56 -0
- package/src/lib/cleanUpJetstreamLock.ts +66 -0
- package/src/lib/cleanUpSyncLock.ts +56 -0
- package/src/lib/didUnstorageCache.ts +72 -0
- package/src/lib/env.ts +25 -0
- package/src/lib/extractPdsFromDid.ts +33 -0
- package/src/lib/getDidAndHandle.ts +39 -0
- package/src/lib/idResolver.ts +52 -0
- package/src/lib/lastfm.ts +26 -0
- package/src/lib/matchTrack.ts +47 -0
- package/src/logger.ts +18 -0
- package/src/schema/album-tracks.ts +30 -0
- package/src/schema/albums.ts +29 -0
- package/src/schema/artist-albums.ts +29 -0
- package/src/schema/artist-genres.ts +17 -0
- package/src/schema/artist-tracks.ts +29 -0
- package/src/schema/artists.ts +30 -0
- package/src/schema/auth-session.ts +18 -0
- package/src/schema/genres.ts +18 -0
- package/src/schema/index.ts +33 -0
- package/src/schema/loved-tracks.ts +27 -0
- package/src/schema/scrobbles.ts +30 -0
- package/src/schema/tracks.ts +47 -0
- package/src/schema/user-albums.ts +31 -0
- package/src/schema/user-artists.ts +32 -0
- package/src/schema/user-tracks.ts +31 -0
- package/src/schema/users.ts +21 -0
- package/src/scrobble.ts +410 -0
- package/src/sqliteKv.ts +173 -0
- package/src/types.ts +308 -0
- package/tsconfig.json +26 -29
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Rocksky CLI
|
|
2
2
|
|
|
3
|
-
🎧 The official command-line interface for [Rocksky](https://rocksky.app) — a modern, decentralized music tracking and discovery platform built on
|
|
3
|
+
🎧 The official command-line interface for [Rocksky](https://rocksky.app) — a modern, decentralized music tracking and discovery platform built on [AT Protocol](https://atproto.com).
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
- 🔐 Authenticate with your Rocksky account using OAuth
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
- [Run in development](#run-in-development)
|
|
16
16
|
- [Usage](#usage)
|
|
17
17
|
- [Available Commands](#available-commands)
|
|
18
|
-
|
|
18
|
+
- [Rocksky MCP Server Tools](#rocksky-mcp-server-tools)
|
|
19
|
+
- [whoami](#whoami)
|
|
19
20
|
- [nowplaying](#nowplaying)
|
|
20
21
|
- [scrobbles](#scrobbles)
|
|
21
22
|
- [search](#search)
|
|
@@ -23,10 +24,6 @@
|
|
|
23
24
|
- [artists](#artists)
|
|
24
25
|
- [albums](#albums)
|
|
25
26
|
- [tracks](#tracks)
|
|
26
|
-
- [scrobble](#scrobble)
|
|
27
|
-
- [mcp](#mcp)
|
|
28
|
-
- [Rocksky MCP Server Tools](#rocksky-mcp-server-tools)
|
|
29
|
-
|
|
30
27
|
|
|
31
28
|
## Installation
|
|
32
29
|
|
|
@@ -74,6 +71,12 @@ rocksky login
|
|
|
74
71
|
rocksky nowplaying
|
|
75
72
|
```
|
|
76
73
|
|
|
74
|
+
`scrobble` - Manually scrobbles a track.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
rocksky scrobble "Karma Police" "Radiohead"
|
|
78
|
+
```
|
|
79
|
+
|
|
77
80
|
`scrobbles` - Lists all recently scrobbled tracks.
|
|
78
81
|
|
|
79
82
|
```bash
|
|
@@ -110,10 +113,16 @@ rocksky albums [did]
|
|
|
110
113
|
rocksky tracks [did]
|
|
111
114
|
```
|
|
112
115
|
|
|
113
|
-
`scrobble` -
|
|
116
|
+
`scrobble-api` - Start a local listenbrainz/lastfm compatibility server
|
|
114
117
|
|
|
115
118
|
```bash
|
|
116
|
-
rocksky scrobble
|
|
119
|
+
rocksky scrobble-api
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`sync` - Sync your local Rocksky data from AT Protocol
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
rocksky sync
|
|
117
126
|
```
|
|
118
127
|
|
|
119
128
|
`whoami` - Displays the current user's information.
|
|
@@ -338,6 +347,3 @@ Create a new API key for the current user.
|
|
|
338
347
|
**Returns:**
|
|
339
348
|
|
|
340
349
|
A confirmation message indicating that the API key was created successfully.
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
CREATE TABLE `album_tracks` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`album_id` text NOT NULL,
|
|
4
|
+
`track_id` text NOT NULL,
|
|
5
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
6
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
7
|
+
FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action,
|
|
8
|
+
FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action
|
|
9
|
+
);
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
CREATE UNIQUE INDEX `album_tracks_unique_index` ON `album_tracks` (`album_id`,`track_id`);--> statement-breakpoint
|
|
12
|
+
CREATE TABLE `albums` (
|
|
13
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
14
|
+
`title` text NOT NULL,
|
|
15
|
+
`artist` text NOT NULL,
|
|
16
|
+
`release_date` text,
|
|
17
|
+
`year` integer,
|
|
18
|
+
`album_art` text,
|
|
19
|
+
`uri` text,
|
|
20
|
+
`cid` text NOT NULL,
|
|
21
|
+
`artist_uri` text,
|
|
22
|
+
`apple_music_link` text,
|
|
23
|
+
`spotify_link` text,
|
|
24
|
+
`tidal_link` text,
|
|
25
|
+
`youtube_link` text,
|
|
26
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
27
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
28
|
+
);
|
|
29
|
+
--> statement-breakpoint
|
|
30
|
+
CREATE UNIQUE INDEX `albums_uri_unique` ON `albums` (`uri`);--> statement-breakpoint
|
|
31
|
+
CREATE UNIQUE INDEX `albums_cid_unique` ON `albums` (`cid`);--> statement-breakpoint
|
|
32
|
+
CREATE UNIQUE INDEX `albums_apple_music_link_unique` ON `albums` (`apple_music_link`);--> statement-breakpoint
|
|
33
|
+
CREATE UNIQUE INDEX `albums_spotify_link_unique` ON `albums` (`spotify_link`);--> statement-breakpoint
|
|
34
|
+
CREATE UNIQUE INDEX `albums_tidal_link_unique` ON `albums` (`tidal_link`);--> statement-breakpoint
|
|
35
|
+
CREATE UNIQUE INDEX `albums_youtube_link_unique` ON `albums` (`youtube_link`);--> statement-breakpoint
|
|
36
|
+
CREATE TABLE `artist_albums` (
|
|
37
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
38
|
+
`artist_id` text NOT NULL,
|
|
39
|
+
`album_id` text NOT NULL,
|
|
40
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
41
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
42
|
+
FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action,
|
|
43
|
+
FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action
|
|
44
|
+
);
|
|
45
|
+
--> statement-breakpoint
|
|
46
|
+
CREATE UNIQUE INDEX `artist_albums_unique_index` ON `artist_albums` (`artist_id`,`album_id`);--> statement-breakpoint
|
|
47
|
+
CREATE TABLE `artist_genres ` (
|
|
48
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
49
|
+
`artist_id` text NOT NULL,
|
|
50
|
+
`genre_id` text NOT NULL
|
|
51
|
+
);
|
|
52
|
+
--> statement-breakpoint
|
|
53
|
+
CREATE UNIQUE INDEX `artist_genre_unique_index` ON `artist_genres ` (`artist_id`,`genre_id`);--> statement-breakpoint
|
|
54
|
+
CREATE TABLE `artist_tracks` (
|
|
55
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
56
|
+
`artist_id` text NOT NULL,
|
|
57
|
+
`track_id` text NOT NULL,
|
|
58
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
59
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
60
|
+
FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action,
|
|
61
|
+
FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action
|
|
62
|
+
);
|
|
63
|
+
--> statement-breakpoint
|
|
64
|
+
CREATE UNIQUE INDEX `artist_tracks_unique_index` ON `artist_tracks` (`artist_id`,`track_id`);--> statement-breakpoint
|
|
65
|
+
CREATE TABLE `artists` (
|
|
66
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
67
|
+
`name` text NOT NULL,
|
|
68
|
+
`biography` text,
|
|
69
|
+
`born` integer,
|
|
70
|
+
`born_in` text,
|
|
71
|
+
`died` integer,
|
|
72
|
+
`picture` text,
|
|
73
|
+
`uri` text,
|
|
74
|
+
`cid` text NOT NULL,
|
|
75
|
+
`apple_music_link` text,
|
|
76
|
+
`spotify_link` text,
|
|
77
|
+
`tidal_link` text,
|
|
78
|
+
`youtube_link` text,
|
|
79
|
+
`genres` text,
|
|
80
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
81
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
82
|
+
);
|
|
83
|
+
--> statement-breakpoint
|
|
84
|
+
CREATE UNIQUE INDEX `artists_uri_unique` ON `artists` (`uri`);--> statement-breakpoint
|
|
85
|
+
CREATE UNIQUE INDEX `artists_cid_unique` ON `artists` (`cid`);--> statement-breakpoint
|
|
86
|
+
CREATE TABLE `auth_sessions` (
|
|
87
|
+
`key` text PRIMARY KEY NOT NULL,
|
|
88
|
+
`session` text NOT NULL,
|
|
89
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
90
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
91
|
+
);
|
|
92
|
+
--> statement-breakpoint
|
|
93
|
+
CREATE TABLE `genres` (
|
|
94
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
95
|
+
`name` text NOT NULL,
|
|
96
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
97
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
98
|
+
);
|
|
99
|
+
--> statement-breakpoint
|
|
100
|
+
CREATE UNIQUE INDEX `genres_name_unique` ON `genres` (`name`);--> statement-breakpoint
|
|
101
|
+
CREATE TABLE `loved_tracks` (
|
|
102
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
103
|
+
`user_id` text NOT NULL,
|
|
104
|
+
`track_id` text NOT NULL,
|
|
105
|
+
`uri` text,
|
|
106
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
107
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
|
|
108
|
+
FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action
|
|
109
|
+
);
|
|
110
|
+
--> statement-breakpoint
|
|
111
|
+
CREATE UNIQUE INDEX `loved_tracks_uri_unique` ON `loved_tracks` (`uri`);--> statement-breakpoint
|
|
112
|
+
CREATE UNIQUE INDEX `loved_tracks_unique_index` ON `loved_tracks` (`user_id`,`track_id`);--> statement-breakpoint
|
|
113
|
+
CREATE TABLE `scrobbles` (
|
|
114
|
+
`xata_id` text PRIMARY KEY NOT NULL,
|
|
115
|
+
`user_id` text,
|
|
116
|
+
`track_id` text,
|
|
117
|
+
`album_id` text,
|
|
118
|
+
`artist_id` text,
|
|
119
|
+
`uri` text,
|
|
120
|
+
`cid` text,
|
|
121
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
122
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
123
|
+
`timestamp` integer DEFAULT (unixepoch()) NOT NULL,
|
|
124
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
|
|
125
|
+
FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action,
|
|
126
|
+
FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action,
|
|
127
|
+
FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action
|
|
128
|
+
);
|
|
129
|
+
--> statement-breakpoint
|
|
130
|
+
CREATE UNIQUE INDEX `scrobbles_uri_unique` ON `scrobbles` (`uri`);--> statement-breakpoint
|
|
131
|
+
CREATE UNIQUE INDEX `scrobbles_cid_unique` ON `scrobbles` (`cid`);--> statement-breakpoint
|
|
132
|
+
CREATE TABLE `tracks` (
|
|
133
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
134
|
+
`title` text NOT NULL,
|
|
135
|
+
`artist` text NOT NULL,
|
|
136
|
+
`album_artist` text NOT NULL,
|
|
137
|
+
`album_art` text,
|
|
138
|
+
`album` text NOT NULL,
|
|
139
|
+
`track_number` integer,
|
|
140
|
+
`duration` integer NOT NULL,
|
|
141
|
+
`mb_id` text,
|
|
142
|
+
`youtube_link` text,
|
|
143
|
+
`spotify_link` text,
|
|
144
|
+
`apple_music_link` text,
|
|
145
|
+
`tidal_link` text,
|
|
146
|
+
`disc_number` integer,
|
|
147
|
+
`lyrics` text,
|
|
148
|
+
`composer` text,
|
|
149
|
+
`genre` text,
|
|
150
|
+
`label` text,
|
|
151
|
+
`copyright_message` text,
|
|
152
|
+
`uri` text,
|
|
153
|
+
`cid` text NOT NULL,
|
|
154
|
+
`album_uri` text,
|
|
155
|
+
`artist_uri` text,
|
|
156
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
157
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
158
|
+
);
|
|
159
|
+
--> statement-breakpoint
|
|
160
|
+
CREATE UNIQUE INDEX `tracks_mb_id_unique` ON `tracks` (`mb_id`);--> statement-breakpoint
|
|
161
|
+
CREATE UNIQUE INDEX `tracks_youtube_link_unique` ON `tracks` (`youtube_link`);--> statement-breakpoint
|
|
162
|
+
CREATE UNIQUE INDEX `tracks_spotify_link_unique` ON `tracks` (`spotify_link`);--> statement-breakpoint
|
|
163
|
+
CREATE UNIQUE INDEX `tracks_apple_music_link_unique` ON `tracks` (`apple_music_link`);--> statement-breakpoint
|
|
164
|
+
CREATE UNIQUE INDEX `tracks_tidal_link_unique` ON `tracks` (`tidal_link`);--> statement-breakpoint
|
|
165
|
+
CREATE UNIQUE INDEX `tracks_uri_unique` ON `tracks` (`uri`);--> statement-breakpoint
|
|
166
|
+
CREATE UNIQUE INDEX `tracks_cid_unique` ON `tracks` (`cid`);--> statement-breakpoint
|
|
167
|
+
CREATE TABLE `user_albums` (
|
|
168
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
169
|
+
`user_id` text NOT NULL,
|
|
170
|
+
`album_id` text NOT NULL,
|
|
171
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
172
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
173
|
+
`scrobbles` integer,
|
|
174
|
+
`uri` text NOT NULL,
|
|
175
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
|
|
176
|
+
FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action
|
|
177
|
+
);
|
|
178
|
+
--> statement-breakpoint
|
|
179
|
+
CREATE UNIQUE INDEX `user_albums_uri_unique` ON `user_albums` (`uri`);--> statement-breakpoint
|
|
180
|
+
CREATE UNIQUE INDEX `user_albums_unique_index` ON `user_albums` (`user_id`,`album_id`);--> statement-breakpoint
|
|
181
|
+
CREATE TABLE `user_artists` (
|
|
182
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
183
|
+
`user_id` text NOT NULL,
|
|
184
|
+
`artist_id` text NOT NULL,
|
|
185
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
186
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
187
|
+
`scrobbles` integer,
|
|
188
|
+
`uri` text NOT NULL,
|
|
189
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
|
|
190
|
+
FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action
|
|
191
|
+
);
|
|
192
|
+
--> statement-breakpoint
|
|
193
|
+
CREATE UNIQUE INDEX `user_artists_uri_unique` ON `user_artists` (`uri`);--> statement-breakpoint
|
|
194
|
+
CREATE UNIQUE INDEX `user_artists_unique_index` ON `user_artists` (`user_id`,`artist_id`);--> statement-breakpoint
|
|
195
|
+
CREATE TABLE `user_tracks` (
|
|
196
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
197
|
+
`user_id` text NOT NULL,
|
|
198
|
+
`track_id` text NOT NULL,
|
|
199
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
200
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
201
|
+
`scrobbles` integer,
|
|
202
|
+
`uri` text NOT NULL,
|
|
203
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
|
|
204
|
+
FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action
|
|
205
|
+
);
|
|
206
|
+
--> statement-breakpoint
|
|
207
|
+
CREATE UNIQUE INDEX `user_tracks_uri_unique` ON `user_tracks` (`uri`);--> statement-breakpoint
|
|
208
|
+
CREATE UNIQUE INDEX `user_tracks_unique_index` ON `user_tracks` (`user_id`,`track_id`);--> statement-breakpoint
|
|
209
|
+
CREATE TABLE `users` (
|
|
210
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
211
|
+
`did` text NOT NULL,
|
|
212
|
+
`display_name` text,
|
|
213
|
+
`handle` text NOT NULL,
|
|
214
|
+
`avatar` text NOT NULL,
|
|
215
|
+
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
|
216
|
+
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
|
217
|
+
);
|
|
218
|
+
--> statement-breakpoint
|
|
219
|
+
CREATE UNIQUE INDEX `users_did_unique` ON `users` (`did`);--> statement-breakpoint
|
|
220
|
+
CREATE UNIQUE INDEX `users_handle_unique` ON `users` (`handle`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE INDEX `idx_title_artist_album_albumartist` ON `tracks` (`title`,`artist`,`album`,`album_artist`);
|