···11CREATE TABLE "album_tracks" (
22- "xata_id" text PRIMARY KEY NOT NULL,
22+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
33 "album_id" text NOT NULL,
44 "track_id" text NOT NULL,
55 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···88);
99--> statement-breakpoint
1010CREATE TABLE "albums" (
1111- "xata_id" text PRIMARY KEY NOT NULL,
1111+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
1212 "title" text NOT NULL,
1313 "artist" text NOT NULL,
1414 "release_date" text,
···3333);
3434--> statement-breakpoint
3535CREATE TABLE "api_keys" (
3636- "xata_id" text PRIMARY KEY NOT NULL,
3636+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
3737 "name" text NOT NULL,
3838 "api_key" text NOT NULL,
3939 "shared_secret" text NOT NULL,
···4545);
4646--> statement-breakpoint
4747CREATE TABLE "artist_albums" (
4848- "xata_id" text PRIMARY KEY NOT NULL,
4848+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
4949 "artist_id" text NOT NULL,
5050 "album_id" text NOT NULL,
5151 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···5454);
5555--> statement-breakpoint
5656CREATE TABLE "artist_tracks" (
5757- "xata_id" text PRIMARY KEY NOT NULL,
5757+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
5858 "artist_id" text NOT NULL,
5959 "track_id" text NOT NULL,
6060 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···6363);
6464--> statement-breakpoint
6565CREATE TABLE "artists" (
6666- "xata_id" text PRIMARY KEY NOT NULL,
6666+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
6767 "name" text NOT NULL,
6868 "biography" text,
6969 "born" timestamp,
···8383 CONSTRAINT "artists_uri_unique" UNIQUE("uri")
8484);
8585--> statement-breakpoint
8686+CREATE TABLE "dropbox_accounts" (
8787+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
8888+ "email" text NOT NULL,
8989+ "is_beta_user" boolean DEFAULT false NOT NULL,
9090+ "user_id" text NOT NULL,
9191+ "xata_version" text NOT NULL,
9292+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
9393+ "xata_updatedat" timestamp DEFAULT now() NOT NULL,
9494+ CONSTRAINT "dropbox_accounts_email_unique" UNIQUE("email")
9595+);
9696+--> statement-breakpoint
9797+CREATE TABLE "dropbox_directories" (
9898+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
9999+ "name" text NOT NULL,
100100+ "path" text NOT NULL,
101101+ "parent_id" text,
102102+ "dropbox_id" text NOT NULL,
103103+ "file_id" text NOT NULL,
104104+ "xata_version" text NOT NULL,
105105+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
106106+ "xata_updatedat" timestamp DEFAULT now() NOT NULL,
107107+ CONSTRAINT "dropbox_directories_file_id_unique" UNIQUE("file_id")
108108+);
109109+--> statement-breakpoint
110110+CREATE TABLE "dropbox_paths" (
111111+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
112112+ "path" text NOT NULL,
113113+ "name" text NOT NULL,
114114+ "dropbox_id" text NOT NULL,
115115+ "track_id" text NOT NULL,
116116+ "directory_id" text,
117117+ "file_id" text NOT NULL,
118118+ "xata_version" text NOT NULL,
119119+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
120120+ "xata_updatedat" timestamp DEFAULT now() NOT NULL,
121121+ CONSTRAINT "dropbox_paths_file_id_unique" UNIQUE("file_id")
122122+);
123123+--> statement-breakpoint
86124CREATE TABLE "dropbox_tokens" (
8787- "xata_id" text PRIMARY KEY NOT NULL,
125125+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
88126 "refresh_token" text NOT NULL,
89127 "xata_createdat" timestamp DEFAULT now() NOT NULL,
90128 "xata_updatedat" timestamp DEFAULT now() NOT NULL
91129);
92130--> statement-breakpoint
131131+CREATE TABLE "dropbox" (
132132+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
133133+ "user_id" text NOT NULL,
134134+ "dropbox_token_id" text NOT NULL,
135135+ "xata_version" text NOT NULL,
136136+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
137137+ "xata_updatedat" timestamp DEFAULT now() NOT NULL
138138+);
139139+--> statement-breakpoint
140140+CREATE TABLE "google_drive_accounts" (
141141+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
142142+ "email" text NOT NULL,
143143+ "is_beta_user" boolean DEFAULT false NOT NULL,
144144+ "user_id" text NOT NULL,
145145+ "xata_version" text NOT NULL,
146146+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
147147+ "xata_updatedat" timestamp DEFAULT now() NOT NULL,
148148+ CONSTRAINT "google_drive_accounts_email_unique" UNIQUE("email")
149149+);
150150+--> statement-breakpoint
151151+CREATE TABLE "google_drive_directories" (
152152+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
153153+ "name" text NOT NULL,
154154+ "path" text NOT NULL,
155155+ "parent_id" text,
156156+ "google_drive_id" text NOT NULL,
157157+ "file_id" text NOT NULL,
158158+ "xata_version" text NOT NULL,
159159+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
160160+ "xata_updatedat" timestamp DEFAULT now() NOT NULL,
161161+ CONSTRAINT "google_drive_directories_file_id_unique" UNIQUE("file_id")
162162+);
163163+--> statement-breakpoint
164164+CREATE TABLE "google_drive_paths" (
165165+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
166166+ "google_drive_id" text NOT NULL,
167167+ "track_id" text NOT NULL,
168168+ "name" text NOT NULL,
169169+ "directory_id" text,
170170+ "file_id" text NOT NULL,
171171+ "xata_version" text NOT NULL,
172172+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
173173+ "xata_updatedat" timestamp DEFAULT now() NOT NULL,
174174+ CONSTRAINT "google_drive_paths_file_id_unique" UNIQUE("file_id")
175175+);
176176+--> statement-breakpoint
93177CREATE TABLE "google_drive_tokens" (
9494- "xata_id" text PRIMARY KEY NOT NULL,
178178+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
95179 "refresh_token" text NOT NULL,
96180 "xata_createdat" timestamp DEFAULT now() NOT NULL,
97181 "xata_updatedat" timestamp DEFAULT now() NOT NULL
98182);
99183--> statement-breakpoint
184184+CREATE TABLE "google_drive" (
185185+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
186186+ "google_drive_token_id" text NOT NULL,
187187+ "user_id" text NOT NULL,
188188+ "xata_version" text NOT NULL,
189189+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
190190+ "xata_updatedat" timestamp DEFAULT now() NOT NULL
191191+);
192192+--> statement-breakpoint
100193CREATE TABLE "loved_tracks" (
101101- "xata_id" text PRIMARY KEY NOT NULL,
194194+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
102195 "user_id" text NOT NULL,
103196 "track_id" text NOT NULL,
104197 "uri" text,
···107200);
108201--> statement-breakpoint
109202CREATE TABLE "playlist_tracks" (
110110- "xata_id" text PRIMARY KEY NOT NULL,
203203+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
111204 "playlist_id" text NOT NULL,
112205 "track_id" text NOT NULL,
113206 "xata_createdat" timestamp DEFAULT now() NOT NULL
114207);
115208--> statement-breakpoint
116209CREATE TABLE "playlists" (
117117- "xata_id" text PRIMARY KEY NOT NULL,
210210+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
118211 "name" text NOT NULL,
119212 "picture" text,
120213 "description" text,
···129222);
130223--> statement-breakpoint
131224CREATE TABLE "profile_shouts" (
132132- "xata_id" text PRIMARY KEY NOT NULL,
225225+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
133226 "user_id" text NOT NULL,
134227 "shout_id" text NOT NULL,
135228 "xata_createdat" timestamp DEFAULT now() NOT NULL
136229);
137230--> statement-breakpoint
231231+CREATE TABLE "queue_tracks" (
232232+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
233233+ "user_id" text NOT NULL,
234234+ "track_id" text NOT NULL,
235235+ "position" integer NOT NULL,
236236+ "file_uri" text NOT NULL,
237237+ "xata_version" integer DEFAULT 0 NOT NULL,
238238+ "xata_createdat" timestamp DEFAULT now() NOT NULL,
239239+ "xata_updatedat" timestamp DEFAULT now() NOT NULL
240240+);
241241+--> statement-breakpoint
138242CREATE TABLE "scrobbles" (
139139- "xata_id" text PRIMARY KEY NOT NULL,
243243+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
140244 "user_id" text,
141245 "track_id" text,
142246 "album_id" text,
···150254);
151255--> statement-breakpoint
152256CREATE TABLE "shout_likes" (
153153- "xata_id" text PRIMARY KEY NOT NULL,
257257+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
154258 "user_id" text NOT NULL,
155259 "shout_id" text NOT NULL,
156260 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···159263);
160264--> statement-breakpoint
161265CREATE TABLE "shout_reports" (
162162- "xata_id" text PRIMARY KEY NOT NULL,
266266+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
163267 "user_id" text NOT NULL,
164268 "shout_id" text NOT NULL,
165269 "xata_createdat" timestamp DEFAULT now() NOT NULL
166270);
167271--> statement-breakpoint
168272CREATE TABLE "shouts" (
169169- "xata_id" text PRIMARY KEY NOT NULL,
273273+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
170274 "content" text NOT NULL,
171275 "track_id" text,
172276 "artist_id" text,
···181285);
182286--> statement-breakpoint
183287CREATE TABLE "spotify_accounts" (
184184- "xata_id" text PRIMARY KEY NOT NULL,
288288+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
185289 "xata_version" integer NOT NULL,
186290 "email" text NOT NULL,
187291 "user_id" text NOT NULL,
···191295);
192296--> statement-breakpoint
193297CREATE TABLE "spotify_tokens" (
194194- "xata_id" text PRIMARY KEY NOT NULL,
298298+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
195299 "xata_version" integer NOT NULL,
196300 "access_token" text NOT NULL,
197301 "refresh_token" text NOT NULL,
···201305);
202306--> statement-breakpoint
203307CREATE TABLE "tracks" (
204204- "xata_id" text PRIMARY KEY NOT NULL,
308308+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
205309 "title" text NOT NULL,
206310 "artist" text NOT NULL,
207311 "album_artist" text NOT NULL,
···239343);
240344--> statement-breakpoint
241345CREATE TABLE "user_albums" (
242242- "xata_id" text PRIMARY KEY NOT NULL,
346346+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
243347 "user_id" text NOT NULL,
244348 "album_id" text NOT NULL,
245349 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···251355);
252356--> statement-breakpoint
253357CREATE TABLE "user_artists" (
254254- "xata_id" text PRIMARY KEY NOT NULL,
358358+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
255359 "user_id" text NOT NULL,
256360 "artist_id" text NOT NULL,
257361 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···263367);
264368--> statement-breakpoint
265369CREATE TABLE "user_playlists" (
266266- "xata_id" text PRIMARY KEY NOT NULL,
370370+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
267371 "user_id" text NOT NULL,
268372 "playlist_id" text NOT NULL,
269373 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···272376);
273377--> statement-breakpoint
274378CREATE TABLE "user_tracks" (
275275- "xata_id" text PRIMARY KEY NOT NULL,
379379+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
276380 "user_id" text NOT NULL,
277381 "track_id" text NOT NULL,
278382 "xata_createdat" timestamp DEFAULT now() NOT NULL,
···284388);
285389--> statement-breakpoint
286390CREATE TABLE "users" (
287287- "xata_id" text PRIMARY KEY NOT NULL,
391391+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
288392 "did" text NOT NULL,
289393 "display_name" text NOT NULL,
290394 "handle" text NOT NULL,
···297401);
298402--> statement-breakpoint
299403CREATE TABLE "webscrobblers" (
300300- "xata_id" text PRIMARY KEY NOT NULL,
404404+ "xata_id" text PRIMARY KEY DEFAULT xata_id(),
301405 "name" text NOT NULL,
302406 "uuid" text NOT NULL,
303407 "description" text,
···314418ALTER TABLE "artist_albums" ADD CONSTRAINT "artist_albums_album_id_albums_xata_id_fk" FOREIGN KEY ("album_id") REFERENCES "public"."albums"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
315419ALTER TABLE "artist_tracks" ADD CONSTRAINT "artist_tracks_artist_id_artists_xata_id_fk" FOREIGN KEY ("artist_id") REFERENCES "public"."artists"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
316420ALTER TABLE "artist_tracks" ADD CONSTRAINT "artist_tracks_track_id_tracks_xata_id_fk" FOREIGN KEY ("track_id") REFERENCES "public"."tracks"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
421421+ALTER TABLE "dropbox_accounts" ADD CONSTRAINT "dropbox_accounts_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
422422+ALTER TABLE "dropbox_directories" ADD CONSTRAINT "dropbox_directories_parent_id_dropbox_directories_xata_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."dropbox_directories"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
423423+ALTER TABLE "dropbox_paths" ADD CONSTRAINT "dropbox_paths_directory_id_dropbox_directories_xata_id_fk" FOREIGN KEY ("directory_id") REFERENCES "public"."dropbox_directories"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
424424+ALTER TABLE "dropbox" ADD CONSTRAINT "dropbox_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
425425+ALTER TABLE "dropbox" ADD CONSTRAINT "dropbox_dropbox_token_id_dropbox_tokens_xata_id_fk" FOREIGN KEY ("dropbox_token_id") REFERENCES "public"."dropbox_tokens"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
426426+ALTER TABLE "google_drive_accounts" ADD CONSTRAINT "google_drive_accounts_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
427427+ALTER TABLE "google_drive_directories" ADD CONSTRAINT "google_drive_directories_parent_id_google_drive_directories_xata_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."google_drive_directories"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
428428+ALTER TABLE "google_drive_paths" ADD CONSTRAINT "google_drive_paths_directory_id_google_drive_directories_xata_id_fk" FOREIGN KEY ("directory_id") REFERENCES "public"."google_drive_directories"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
429429+ALTER TABLE "google_drive" ADD CONSTRAINT "google_drive_google_drive_token_id_google_drive_tokens_xata_id_fk" FOREIGN KEY ("google_drive_token_id") REFERENCES "public"."google_drive_tokens"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
430430+ALTER TABLE "google_drive" ADD CONSTRAINT "google_drive_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
317431ALTER TABLE "loved_tracks" ADD CONSTRAINT "loved_tracks_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
318432ALTER TABLE "loved_tracks" ADD CONSTRAINT "loved_tracks_track_id_tracks_xata_id_fk" FOREIGN KEY ("track_id") REFERENCES "public"."tracks"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
319433ALTER TABLE "playlist_tracks" ADD CONSTRAINT "playlist_tracks_playlist_id_playlists_xata_id_fk" FOREIGN KEY ("playlist_id") REFERENCES "public"."playlists"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
···321435ALTER TABLE "playlists" ADD CONSTRAINT "playlists_created_by_users_xata_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
322436ALTER TABLE "profile_shouts" ADD CONSTRAINT "profile_shouts_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
323437ALTER TABLE "profile_shouts" ADD CONSTRAINT "profile_shouts_shout_id_shouts_xata_id_fk" FOREIGN KEY ("shout_id") REFERENCES "public"."shouts"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
438438+ALTER TABLE "queue_tracks" ADD CONSTRAINT "queue_tracks_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
439439+ALTER TABLE "queue_tracks" ADD CONSTRAINT "queue_tracks_track_id_tracks_xata_id_fk" FOREIGN KEY ("track_id") REFERENCES "public"."tracks"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
324440ALTER TABLE "scrobbles" ADD CONSTRAINT "scrobbles_user_id_users_xata_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
325441ALTER TABLE "scrobbles" ADD CONSTRAINT "scrobbles_track_id_tracks_xata_id_fk" FOREIGN KEY ("track_id") REFERENCES "public"."tracks"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
326442ALTER TABLE "scrobbles" ADD CONSTRAINT "scrobbles_album_id_albums_xata_id_fk" FOREIGN KEY ("album_id") REFERENCES "public"."albums"("xata_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint