A decentralized music tracking and discovery platform built on AT Protocol 馃幍 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
at main 26 lines 1.1 kB view raw
1import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm"; 2import { integer, pgTable, text, timestamp } from "drizzle-orm/pg-core"; 3import albums from "./albums.ts"; 4import artists from "./artists.ts"; 5import tracks from "./tracks.ts"; 6import users from "./users.ts"; 7 8const scrobbles = pgTable("scrobbles", { 9 id: text("xata_id") 10 .primaryKey() 11 .default(sql`xata_id()`), 12 userId: text("user_id").references(() => users.id), 13 trackId: text("track_id").references(() => tracks.id), 14 albumId: text("album_id").references(() => albums.id), 15 artistId: text("artist_id").references(() => artists.id), 16 uri: text("uri").unique(), 17 createdAt: timestamp("xata_createdat").defaultNow().notNull(), 18 updatedAt: timestamp("xata_updatedat").defaultNow().notNull(), 19 xataVersion: integer("xata_version"), 20 timestamp: timestamp("timestamp").defaultNow().notNull(), 21}); 22 23export type SelectScrobble = InferSelectModel<typeof scrobbles>; 24export type InsertScrobble = InferInsertModel<typeof scrobbles>; 25 26export default scrobbles;