Replace CURRENT_TIMESTAMP defaults with (unixepoch()) across schemas and migration metadata. Enhance matchTrack to also match by albumArtist and log the database query result.
···22 `id` text PRIMARY KEY NOT NULL,
33 `album_id` text NOT NULL,
44 `track_id` text NOT NULL,
55- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
66- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
55+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
66+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL,
77 FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action,
88 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action
99);
···2323 `spotify_link` text,
2424 `tidal_link` text,
2525 `youtube_link` text,
2626- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
2727- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
2626+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
2727+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL
2828);
2929--> statement-breakpoint
3030CREATE UNIQUE INDEX `albums_uri_unique` ON `albums` (`uri`);--> statement-breakpoint
···3737 `id` text PRIMARY KEY NOT NULL,
3838 `artist_id` text NOT NULL,
3939 `album_id` text NOT NULL,
4040- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
4141- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
4040+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
4141+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL,
4242 FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action,
4343 FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action
4444);
···5555 `id` text PRIMARY KEY NOT NULL,
5656 `artist_id` text NOT NULL,
5757 `track_id` text NOT NULL,
5858- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
5959- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
5858+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
5959+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL,
6060 FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action,
6161 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action
6262);
···7777 `tidal_link` text,
7878 `youtube_link` text,
7979 `genres` text,
8080- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
8181- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
8080+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
8181+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL
8282);
8383--> statement-breakpoint
8484CREATE UNIQUE INDEX `artists_uri_unique` ON `artists` (`uri`);--> statement-breakpoint
···8686CREATE TABLE `auth_sessions` (
8787 `key` text PRIMARY KEY NOT NULL,
8888 `session` text NOT NULL,
8989- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
9090- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
8989+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
9090+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL
9191);
9292--> statement-breakpoint
9393CREATE TABLE `genres` (
9494 `id` text PRIMARY KEY NOT NULL,
9595 `name` text NOT NULL,
9696- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
9797- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
9696+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
9797+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL
9898);
9999--> statement-breakpoint
100100CREATE UNIQUE INDEX `genres_name_unique` ON `genres` (`name`);--> statement-breakpoint
···103103 `user_id` text NOT NULL,
104104 `track_id` text NOT NULL,
105105 `uri` text,
106106- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
106106+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
107107 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
108108 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action
109109);
···118118 `artist_id` text,
119119 `uri` text,
120120 `cid` text,
121121- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
122122- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
123123- `timestamp` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
121121+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
122122+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL,
123123+ `timestamp` integer DEFAULT (unixepoch()) NOT NULL,
124124 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
125125 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action,
126126 FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action,
···153153 `cid` text NOT NULL,
154154 `album_uri` text,
155155 `artist_uri` text,
156156- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
157157- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
156156+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
157157+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL
158158);
159159--> statement-breakpoint
160160CREATE UNIQUE INDEX `tracks_mb_id_unique` ON `tracks` (`mb_id`);--> statement-breakpoint
···168168 `id` text PRIMARY KEY NOT NULL,
169169 `user_id` text NOT NULL,
170170 `album_id` text NOT NULL,
171171- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
172172- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
171171+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
172172+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL,
173173 `scrobbles` integer,
174174 `uri` text NOT NULL,
175175 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
···182182 `id` text PRIMARY KEY NOT NULL,
183183 `user_id` text NOT NULL,
184184 `artist_id` text NOT NULL,
185185- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
186186- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
185185+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
186186+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL,
187187 `scrobbles` integer,
188188 `uri` text NOT NULL,
189189 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
···196196 `id` text PRIMARY KEY NOT NULL,
197197 `user_id` text NOT NULL,
198198 `track_id` text NOT NULL,
199199- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
200200- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
199199+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
200200+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL,
201201 `scrobbles` integer,
202202 `uri` text NOT NULL,
203203 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
···212212 `display_name` text,
213213 `handle` text NOT NULL,
214214 `avatar` text NOT NULL,
215215- `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
216216- `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
215215+ `created_at` integer DEFAULT (unixepoch()) NOT NULL,
216216+ `updated_at` integer DEFAULT (unixepoch()) NOT NULL
217217);
218218--> statement-breakpoint
219219CREATE UNIQUE INDEX `users_did_unique` ON `users` (`did`);--> statement-breakpoint