A decentralized music tracking and discovery platform built on AT Protocol 🎵 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz

Use unixepoch() for default timestamps

Replace CURRENT_TIMESTAMP defaults with (unixepoch()) across schemas and
migration metadata. Enhance matchTrack to also match by albumArtist and
log the database query result.

+99 -89
+28 -28
apps/cli/drizzle/0000_thankful_leader.sql apps/cli/drizzle/0000_parallel_paper_doll.sql
··· 2 2 `id` text PRIMARY KEY NOT NULL, 3 3 `album_id` text NOT NULL, 4 4 `track_id` text NOT NULL, 5 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 6 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 5 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 6 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, 7 7 FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action, 8 8 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action 9 9 ); ··· 23 23 `spotify_link` text, 24 24 `tidal_link` text, 25 25 `youtube_link` text, 26 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 27 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL 26 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 27 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL 28 28 ); 29 29 --> statement-breakpoint 30 30 CREATE UNIQUE INDEX `albums_uri_unique` ON `albums` (`uri`);--> statement-breakpoint ··· 37 37 `id` text PRIMARY KEY NOT NULL, 38 38 `artist_id` text NOT NULL, 39 39 `album_id` text NOT NULL, 40 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 41 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 40 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 41 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, 42 42 FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action, 43 43 FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action 44 44 ); ··· 55 55 `id` text PRIMARY KEY NOT NULL, 56 56 `artist_id` text NOT NULL, 57 57 `track_id` text NOT NULL, 58 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 59 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 58 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 59 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, 60 60 FOREIGN KEY (`artist_id`) REFERENCES `artists`(`id`) ON UPDATE no action ON DELETE no action, 61 61 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action 62 62 ); ··· 77 77 `tidal_link` text, 78 78 `youtube_link` text, 79 79 `genres` text, 80 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 81 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL 80 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 81 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL 82 82 ); 83 83 --> statement-breakpoint 84 84 CREATE UNIQUE INDEX `artists_uri_unique` ON `artists` (`uri`);--> statement-breakpoint ··· 86 86 CREATE TABLE `auth_sessions` ( 87 87 `key` text PRIMARY KEY NOT NULL, 88 88 `session` text NOT NULL, 89 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 90 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL 89 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 90 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL 91 91 ); 92 92 --> statement-breakpoint 93 93 CREATE TABLE `genres` ( 94 94 `id` text PRIMARY KEY NOT NULL, 95 95 `name` text NOT NULL, 96 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 97 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL 96 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 97 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL 98 98 ); 99 99 --> statement-breakpoint 100 100 CREATE UNIQUE INDEX `genres_name_unique` ON `genres` (`name`);--> statement-breakpoint ··· 103 103 `user_id` text NOT NULL, 104 104 `track_id` text NOT NULL, 105 105 `uri` text, 106 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 106 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 107 107 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, 108 108 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action 109 109 ); ··· 118 118 `artist_id` text, 119 119 `uri` text, 120 120 `cid` text, 121 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 122 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 123 - `timestamp` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 121 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 122 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, 123 + `timestamp` integer DEFAULT (unixepoch()) NOT NULL, 124 124 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, 125 125 FOREIGN KEY (`track_id`) REFERENCES `tracks`(`id`) ON UPDATE no action ON DELETE no action, 126 126 FOREIGN KEY (`album_id`) REFERENCES `albums`(`id`) ON UPDATE no action ON DELETE no action, ··· 153 153 `cid` text NOT NULL, 154 154 `album_uri` text, 155 155 `artist_uri` text, 156 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 157 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL 156 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 157 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL 158 158 ); 159 159 --> statement-breakpoint 160 160 CREATE UNIQUE INDEX `tracks_mb_id_unique` ON `tracks` (`mb_id`);--> statement-breakpoint ··· 168 168 `id` text PRIMARY KEY NOT NULL, 169 169 `user_id` text NOT NULL, 170 170 `album_id` text NOT NULL, 171 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 172 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 171 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 172 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, 173 173 `scrobbles` integer, 174 174 `uri` text NOT NULL, 175 175 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, ··· 182 182 `id` text PRIMARY KEY NOT NULL, 183 183 `user_id` text NOT NULL, 184 184 `artist_id` text NOT NULL, 185 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 186 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 185 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 186 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, 187 187 `scrobbles` integer, 188 188 `uri` text NOT NULL, 189 189 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, ··· 196 196 `id` text PRIMARY KEY NOT NULL, 197 197 `user_id` text NOT NULL, 198 198 `track_id` text NOT NULL, 199 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 200 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 199 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 200 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, 201 201 `scrobbles` integer, 202 202 `uri` text NOT NULL, 203 203 FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, ··· 212 212 `display_name` text, 213 213 `handle` text NOT NULL, 214 214 `avatar` text NOT NULL, 215 - `created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL, 216 - `updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL 215 + `created_at` integer DEFAULT (unixepoch()) NOT NULL, 216 + `updated_at` integer DEFAULT (unixepoch()) NOT NULL 217 217 ); 218 218 --> statement-breakpoint 219 219 CREATE UNIQUE INDEX `users_did_unique` ON `users` (`did`);--> statement-breakpoint
+29 -29
apps/cli/drizzle/meta/0000_snapshot.json
··· 1 1 { 2 2 "version": "6", 3 3 "dialect": "sqlite", 4 - "id": "0542b673-3d07-4b88-91a8-591a3a265288", 4 + "id": "926f883e-c7c5-4c01-b88b-c8f7f649559a", 5 5 "prevId": "00000000-0000-0000-0000-000000000000", 6 6 "tables": { 7 7 "album_tracks": { ··· 34 34 "primaryKey": false, 35 35 "notNull": true, 36 36 "autoincrement": false, 37 - "default": "CURRENT_TIMESTAMP" 37 + "default": "(unixepoch())" 38 38 }, 39 39 "updated_at": { 40 40 "name": "updated_at", ··· 42 42 "primaryKey": false, 43 43 "notNull": true, 44 44 "autoincrement": false, 45 - "default": "CURRENT_TIMESTAMP" 45 + "default": "(unixepoch())" 46 46 } 47 47 }, 48 48 "indexes": { ··· 187 187 "primaryKey": false, 188 188 "notNull": true, 189 189 "autoincrement": false, 190 - "default": "CURRENT_TIMESTAMP" 190 + "default": "(unixepoch())" 191 191 }, 192 192 "updated_at": { 193 193 "name": "updated_at", ··· 195 195 "primaryKey": false, 196 196 "notNull": true, 197 197 "autoincrement": false, 198 - "default": "CURRENT_TIMESTAMP" 198 + "default": "(unixepoch())" 199 199 } 200 200 }, 201 201 "indexes": { ··· 277 277 "primaryKey": false, 278 278 "notNull": true, 279 279 "autoincrement": false, 280 - "default": "CURRENT_TIMESTAMP" 280 + "default": "(unixepoch())" 281 281 }, 282 282 "updated_at": { 283 283 "name": "updated_at", ··· 285 285 "primaryKey": false, 286 286 "notNull": true, 287 287 "autoincrement": false, 288 - "default": "CURRENT_TIMESTAMP" 288 + "default": "(unixepoch())" 289 289 } 290 290 }, 291 291 "indexes": { ··· 400 400 "primaryKey": false, 401 401 "notNull": true, 402 402 "autoincrement": false, 403 - "default": "CURRENT_TIMESTAMP" 403 + "default": "(unixepoch())" 404 404 }, 405 405 "updated_at": { 406 406 "name": "updated_at", ··· 408 408 "primaryKey": false, 409 409 "notNull": true, 410 410 "autoincrement": false, 411 - "default": "CURRENT_TIMESTAMP" 411 + "default": "(unixepoch())" 412 412 } 413 413 }, 414 414 "indexes": { ··· 560 560 "primaryKey": false, 561 561 "notNull": true, 562 562 "autoincrement": false, 563 - "default": "CURRENT_TIMESTAMP" 563 + "default": "(unixepoch())" 564 564 }, 565 565 "updated_at": { 566 566 "name": "updated_at", ··· 568 568 "primaryKey": false, 569 569 "notNull": true, 570 570 "autoincrement": false, 571 - "default": "CURRENT_TIMESTAMP" 571 + "default": "(unixepoch())" 572 572 } 573 573 }, 574 574 "indexes": { ··· 615 615 "primaryKey": false, 616 616 "notNull": true, 617 617 "autoincrement": false, 618 - "default": "CURRENT_TIMESTAMP" 618 + "default": "(unixepoch())" 619 619 }, 620 620 "updated_at": { 621 621 "name": "updated_at", ··· 623 623 "primaryKey": false, 624 624 "notNull": true, 625 625 "autoincrement": false, 626 - "default": "CURRENT_TIMESTAMP" 626 + "default": "(unixepoch())" 627 627 } 628 628 }, 629 629 "indexes": {}, ··· 655 655 "primaryKey": false, 656 656 "notNull": true, 657 657 "autoincrement": false, 658 - "default": "CURRENT_TIMESTAMP" 658 + "default": "(unixepoch())" 659 659 }, 660 660 "updated_at": { 661 661 "name": "updated_at", ··· 663 663 "primaryKey": false, 664 664 "notNull": true, 665 665 "autoincrement": false, 666 - "default": "CURRENT_TIMESTAMP" 666 + "default": "(unixepoch())" 667 667 } 668 668 }, 669 669 "indexes": { ··· 717 717 "primaryKey": false, 718 718 "notNull": true, 719 719 "autoincrement": false, 720 - "default": "CURRENT_TIMESTAMP" 720 + "default": "(unixepoch())" 721 721 } 722 722 }, 723 723 "indexes": { ··· 827 827 "primaryKey": false, 828 828 "notNull": true, 829 829 "autoincrement": false, 830 - "default": "CURRENT_TIMESTAMP" 830 + "default": "(unixepoch())" 831 831 }, 832 832 "updated_at": { 833 833 "name": "updated_at", ··· 835 835 "primaryKey": false, 836 836 "notNull": true, 837 837 "autoincrement": false, 838 - "default": "CURRENT_TIMESTAMP" 838 + "default": "(unixepoch())" 839 839 }, 840 840 "timestamp": { 841 841 "name": "timestamp", ··· 843 843 "primaryKey": false, 844 844 "notNull": true, 845 845 "autoincrement": false, 846 - "default": "CURRENT_TIMESTAMP" 846 + "default": "(unixepoch())" 847 847 } 848 848 }, 849 849 "indexes": { ··· 1090 1090 "primaryKey": false, 1091 1091 "notNull": true, 1092 1092 "autoincrement": false, 1093 - "default": "CURRENT_TIMESTAMP" 1093 + "default": "(unixepoch())" 1094 1094 }, 1095 1095 "updated_at": { 1096 1096 "name": "updated_at", ··· 1098 1098 "primaryKey": false, 1099 1099 "notNull": true, 1100 1100 "autoincrement": false, 1101 - "default": "CURRENT_TIMESTAMP" 1101 + "default": "(unixepoch())" 1102 1102 } 1103 1103 }, 1104 1104 "indexes": { ··· 1187 1187 "primaryKey": false, 1188 1188 "notNull": true, 1189 1189 "autoincrement": false, 1190 - "default": "CURRENT_TIMESTAMP" 1190 + "default": "(unixepoch())" 1191 1191 }, 1192 1192 "updated_at": { 1193 1193 "name": "updated_at", ··· 1195 1195 "primaryKey": false, 1196 1196 "notNull": true, 1197 1197 "autoincrement": false, 1198 - "default": "CURRENT_TIMESTAMP" 1198 + "default": "(unixepoch())" 1199 1199 }, 1200 1200 "scrobbles": { 1201 1201 "name": "scrobbles", ··· 1291 1291 "primaryKey": false, 1292 1292 "notNull": true, 1293 1293 "autoincrement": false, 1294 - "default": "CURRENT_TIMESTAMP" 1294 + "default": "(unixepoch())" 1295 1295 }, 1296 1296 "updated_at": { 1297 1297 "name": "updated_at", ··· 1299 1299 "primaryKey": false, 1300 1300 "notNull": true, 1301 1301 "autoincrement": false, 1302 - "default": "CURRENT_TIMESTAMP" 1302 + "default": "(unixepoch())" 1303 1303 }, 1304 1304 "scrobbles": { 1305 1305 "name": "scrobbles", ··· 1395 1395 "primaryKey": false, 1396 1396 "notNull": true, 1397 1397 "autoincrement": false, 1398 - "default": "CURRENT_TIMESTAMP" 1398 + "default": "(unixepoch())" 1399 1399 }, 1400 1400 "updated_at": { 1401 1401 "name": "updated_at", ··· 1403 1403 "primaryKey": false, 1404 1404 "notNull": true, 1405 1405 "autoincrement": false, 1406 - "default": "CURRENT_TIMESTAMP" 1406 + "default": "(unixepoch())" 1407 1407 }, 1408 1408 "scrobbles": { 1409 1409 "name": "scrobbles", ··· 1513 1513 "primaryKey": false, 1514 1514 "notNull": true, 1515 1515 "autoincrement": false, 1516 - "default": "CURRENT_TIMESTAMP" 1516 + "default": "(unixepoch())" 1517 1517 }, 1518 1518 "updated_at": { 1519 1519 "name": "updated_at", ··· 1521 1521 "primaryKey": false, 1522 1522 "notNull": true, 1523 1523 "autoincrement": false, 1524 - "default": "CURRENT_TIMESTAMP" 1524 + "default": "(unixepoch())" 1525 1525 } 1526 1526 }, 1527 1527 "indexes": {
+2 -2
apps/cli/drizzle/meta/_journal.json
··· 5 5 { 6 6 "idx": 0, 7 7 "version": "6", 8 - "when": 1768051808522, 9 - "tag": "0000_thankful_leader", 8 + "when": 1768065262210, 9 + "tag": "0000_parallel_paper_doll", 10 10 "breakpoints": true 11 11 } 12 12 ]
+12 -2
apps/cli/src/lib/matchTrack.ts
··· 1 1 import { ctx } from "context"; 2 + import { eq, and, or } from "drizzle-orm"; 2 3 import { logger } from "logger"; 3 4 import schema from "schema"; 4 5 5 6 export async function matchTrack(track: string, artist: string) { 6 - await ctx.db 7 + const [result] = await ctx.db 7 8 .select() 8 9 .from(schema.tracks) 9 - 10 + .where( 11 + or( 12 + and(eq(schema.tracks.title, track), eq(schema.tracks.artist, artist)), 13 + and( 14 + eq(schema.tracks.title, track), 15 + eq(schema.tracks.albumArtist, artist), 16 + ), 17 + ), 18 + ) 10 19 .execute(); 11 20 logger.info`>> matchTrack ${track}, ${artist}`; 21 + logger.info`>> matchTrack result \n ${result}`; 12 22 }
+2 -2
apps/cli/src/schema/album-tracks.ts
··· 15 15 .references(() => tracks.id), 16 16 createdAt: integer("created_at") 17 17 .notNull() 18 - .default(sql`CURRENT_TIMESTAMP`), 18 + .default(sql`(unixepoch())`), 19 19 updatedAt: integer("updated_at") 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 }, 23 23 24 24 (t) => [unique("album_tracks_unique_index").on(t.albumId, t.trackId)],
+2 -2
apps/cli/src/schema/albums.ts
··· 17 17 youtubeLink: text("youtube_link").unique(), 18 18 createdAt: integer("created_at", { mode: "timestamp" }) 19 19 .notNull() 20 - .default(sql`CURRENT_TIMESTAMP`), 20 + .default(sql`(unixepoch())`), 21 21 updatedAt: integer("updated_at", { mode: "timestamp" }) 22 22 .notNull() 23 - .default(sql`CURRENT_TIMESTAMP`), 23 + .default(sql`(unixepoch())`), 24 24 }); 25 25 26 26 export type SelectAlbum = InferSelectModel<typeof albums>;
+2 -2
apps/cli/src/schema/artist-albums.ts
··· 15 15 .references(() => albums.id), 16 16 createdAt: integer("created_at") 17 17 .notNull() 18 - .default(sql`CURRENT_TIMESTAMP`), 18 + .default(sql`(unixepoch())`), 19 19 updatedAt: integer("updated_at") 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 }, 23 23 (t) => [unique("artist_albums_unique_index").on(t.artistId, t.albumId)], 24 24 );
+2 -2
apps/cli/src/schema/artist-tracks.ts
··· 15 15 .references(() => tracks.id), 16 16 createdAt: integer("created_at", { mode: "timestamp" }) 17 17 .notNull() 18 - .default(sql`CURRENT_TIMESTAMP`), 18 + .default(sql`(unixepoch())`), 19 19 updatedAt: integer("updated_at", { mode: "timestamp" }) 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 }, 23 23 (t) => [unique("artist_tracks_unique_index").on(t.artistId, t.trackId)], 24 24 );
+2 -2
apps/cli/src/schema/artists.ts
··· 18 18 genres: text("genres"), 19 19 createdAt: integer("created_at", { mode: "timestamp" }) 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 updatedAt: integer("updated_at", { mode: "timestamp" }) 23 23 .notNull() 24 - .default(sql`CURRENT_TIMESTAMP`), 24 + .default(sql`(unixepoch())`), 25 25 }); 26 26 27 27 export type SelectArtist = InferSelectModel<typeof artists>;
+2 -2
apps/cli/src/schema/auth-session.ts
··· 6 6 session: text("session").notNull(), 7 7 createdAt: integer("created_at", { mode: "timestamp" }) 8 8 .notNull() 9 - .default(sql`CURRENT_TIMESTAMP`), 9 + .default(sql`(unixepoch())`), 10 10 updatedAt: integer("updated_at", { mode: "timestamp" }) 11 11 .notNull() 12 - .default(sql`CURRENT_TIMESTAMP`), 12 + .default(sql`(unixepoch())`), 13 13 }); 14 14 15 15 export type SelectAuthSession = InferSelectModel<typeof authSessions>;
+2 -2
apps/cli/src/schema/genres.ts
··· 6 6 name: text("name").unique().notNull(), 7 7 createdAt: integer("created_at", { mode: "timestamp" }) 8 8 .notNull() 9 - .default(sql`CURRENT_TIMESTAMP`), 9 + .default(sql`(unixepoch())`), 10 10 updatedAt: integer("updated_at", { mode: "timestamp" }) 11 11 .notNull() 12 - .default(sql`CURRENT_TIMESTAMP`), 12 + .default(sql`(unixepoch())`), 13 13 }); 14 14 15 15 export type SelectGenre = InferSelectModel<typeof genres>;
+1 -1
apps/cli/src/schema/loved-tracks.ts
··· 16 16 uri: text("uri").unique(), 17 17 createdAt: integer("created_at") 18 18 .notNull() 19 - .default(sql`CURRENT_TIMESTAMP`), 19 + .default(sql`(unixepoch())`), 20 20 }, 21 21 (t) => [unique("loved_tracks_unique_index").on(t.userId, t.trackId)], 22 22 );
+3 -3
apps/cli/src/schema/scrobbles.ts
··· 15 15 cid: text("cid").unique(), 16 16 createdAt: integer("created_at", { mode: "timestamp" }) 17 17 .notNull() 18 - .default(sql`CURRENT_TIMESTAMP`), 18 + .default(sql`(unixepoch())`), 19 19 updatedAt: integer("updated_at", { mode: "timestamp" }) 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 timestamp: integer("timestamp", { mode: "timestamp" }) 23 23 .notNull() 24 - .default(sql`CURRENT_TIMESTAMP`), 24 + .default(sql`(unixepoch())`), 25 25 }); 26 26 27 27 export type SelectScrobble = InferSelectModel<typeof scrobbles>;
+2 -2
apps/cli/src/schema/tracks.ts
··· 27 27 artistUri: text("artist_uri"), 28 28 createdAt: integer("created_at", { mode: "timestamp" }) 29 29 .notNull() 30 - .default(sql`CURRENT_TIMESTAMP`), 30 + .default(sql`(unixepoch())`), 31 31 updatedAt: integer("updated_at", { mode: "timestamp" }) 32 32 .notNull() 33 - .default(sql`CURRENT_TIMESTAMP`), 33 + .default(sql`(unixepoch())`), 34 34 }); 35 35 36 36 export type SelectTrack = InferSelectModel<typeof tracks>;
+2 -2
apps/cli/src/schema/user-albums.ts
··· 15 15 .references(() => albums.id), 16 16 createdAt: integer("created_at", { mode: "timestamp" }) 17 17 .notNull() 18 - .default(sql`CURRENT_TIMESTAMP`), 18 + .default(sql`(unixepoch())`), 19 19 updatedAt: integer("updated_at", { mode: "timestamp" }) 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 scrobbles: integer("scrobbles"), 23 23 uri: text("uri").unique().notNull(), 24 24 },
+2 -2
apps/cli/src/schema/user-artists.ts
··· 15 15 .references(() => artists.id), 16 16 createdAt: integer("created_at", { mode: "timestamp" }) 17 17 .notNull() 18 - .default(sql`CURRENT_TIMESTAMP`), 18 + .default(sql`(unixepoch())`), 19 19 updatedAt: integer("updated_at", { mode: "timestamp" }) 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 scrobbles: integer("scrobbles"), 23 23 uri: text("uri").unique().notNull(), 24 24 },
+2 -2
apps/cli/src/schema/user-tracks.ts
··· 15 15 .references(() => tracks.id), 16 16 createdAt: integer("created_at", { mode: "timestamp" }) 17 17 .notNull() 18 - .default(sql`CURRENT_TIMESTAMP`), 18 + .default(sql`(unixepoch())`), 19 19 updatedAt: integer("updated_at", { mode: "timestamp" }) 20 20 .notNull() 21 - .default(sql`CURRENT_TIMESTAMP`), 21 + .default(sql`(unixepoch())`), 22 22 scrobbles: integer("scrobbles"), 23 23 uri: text("uri").unique().notNull(), 24 24 },
+2 -2
apps/cli/src/schema/users.ts
··· 9 9 avatar: text("avatar").notNull(), 10 10 createdAt: integer("created_at", { mode: "timestamp" }) 11 11 .notNull() 12 - .default(sql`CURRENT_TIMESTAMP`), 12 + .default(sql`(unixepoch())`), 13 13 updatedAt: integer("updated_at", { mode: "timestamp" }) 14 14 .notNull() 15 - .default(sql`CURRENT_TIMESTAMP`), 15 + .default(sql`(unixepoch())`), 16 16 }); 17 17 18 18 export type SelectUser = InferSelectModel<typeof users>;