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")
6 .primaryKey()
7 .default(sql`xata_id()`),
8 title: text("title").notNull(),
9 artist: text("artist").notNull(),
10 albumArtist: text("album_artist").notNull(),
11 albumArt: text("album_art"),
12 album: text("album").notNull(),
13 trackNumber: integer("track_number"),
14 duration: integer("duration").notNull(),
15 mbId: text("mb_id").unique(),
16 youtubeLink: text("youtube_link").unique(),
17 spotifyLink: text("spotify_link").unique(),
18 appleMusicLink: text("apple_music_link").unique(),
19 tidalLink: text("tidal_link").unique(),
20 sha256: text("sha256").unique().notNull(),
21 discNumber: integer("disc_number"),
22 lyrics: text("lyrics"),
23 composer: text("composer"),
24 genre: text("genre"),
25 label: text("label"),
26 copyrightMessage: text("copyright_message"),
27 uri: text("uri").unique(),
28 albumUri: text("album_uri"),
29 artistUri: text("artist_uri"),
30 createdAt: timestamp("xata_createdat").defaultNow().notNull(),
31 updatedAt: timestamp("xata_updatedat").defaultNow().notNull(),
32 xataVersion: integer("xata_version"),
33});
34
35export type SelectTrack = InferSelectModel<typeof tracks>;
36export type InsertTrack = InferInsertModel<typeof tracks>;
37
38export default tracks;