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