UNPKG

@rocksky/cli

Version:

Command-line interface for Rocksky – scrobble tracks, view stats, and manage your listening history

31 lines (26 loc) 916 B
import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm"; import { integer, sqliteTable, text, unique } from "drizzle-orm/sqlite-core"; import albums from "./albums"; import tracks from "./tracks"; const albumTracks = sqliteTable( "album_tracks", { id: text("id").primaryKey().notNull(), albumId: text("album_id") .notNull() .references(() => albums.id), trackId: text("track_id") .notNull() .references(() => tracks.id), createdAt: integer("created_at") .notNull() .default(sql`(unixepoch())`), updatedAt: integer("updated_at") .notNull() .default(sql`(unixepoch())`), }, (t) => [unique("album_tracks_unique_index").on(t.albumId, t.trackId)], ); export type SelectAlbumTrack = InferSelectModel<typeof albumTracks>; export type InsertAlbumTrack = InferInsertModel<typeof albumTracks>; export default albumTracks;