A decentralized music tracking and discovery platform built on AT Protocol 馃幍
rocksky.app
spotify
atproto
lastfm
musicbrainz
scrobbling
listenbrainz
1import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm";
2import { integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
3
4const tracks = pgTable("tracks", {
5 id: text("xata_id").primaryKey().default(sql`xata_id()`),
6 title: text("title").notNull(),
7 artist: text("artist").notNull(),
8 albumArtist: text("album_artist").notNull(),
9 albumArt: text("album_art"),
10 album: text("album").notNull(),
11 trackNumber: integer("track_number"),
12 duration: integer("duration").notNull(),
13 mbId: text("mb_id").unique(),
14 youtubeLink: text("youtube_link").unique(),
15 spotifyLink: text("spotify_link").unique(),
16 appleMusicLink: text("apple_music_link").unique(),
17 tidalLink: text("tidal_link").unique(),
18 sha256: text("sha256").unique().notNull(),
19 discNumber: integer("disc_number"),
20 lyrics: text("lyrics"),
21 composer: text("composer"),
22 genre: text("genre"),
23 label: text("label"),
24 copyrightMessage: text("copyright_message"),
25 uri: text("uri").unique(),
26 albumUri: text("album_uri"),
27 artistUri: text("artist_uri"),
28 createdAt: timestamp("xata_createdat").defaultNow().notNull(),
29 updatedAt: timestamp("xata_updatedat").defaultNow().notNull(),
30 xataVersion: integer("xata_version"),
31});
32
33export type SelectTrack = InferSelectModel<typeof tracks>;
34export type InsertTrack = InferInsertModel<typeof tracks>;
35
36export default tracks;