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 { pgTable, text, timestamp } from "drizzle-orm/pg-core";
3import albums from "./albums";
4import scrobbles from "./scrobbles";
5import tracks from "./tracks";
6import users from "./users";
7
8const shouts = pgTable("shouts", {
9 id: text("xata_id").primaryKey().default(sql`xata_id()`),
10 content: text("content").notNull(),
11 trackId: text("track_id").references(() => tracks.id),
12 artistId: text("artist_id").references(() => users.id),
13 albumId: text("album_id").references(() => albums.id),
14 scrobbleId: text("scrobble_id").references(() => scrobbles.id),
15 uri: text("uri").unique().notNull(),
16 authorId: text("author_id")
17 .references(() => users.id)
18 .notNull(),
19 parentId: text("parent_id").references(() => shouts.id),
20 createdAt: timestamp("xata_createdat").defaultNow().notNull(),
21 updatedAt: timestamp("xata_updatedat").defaultNow().notNull(),
22});
23
24export type SelectShout = InferSelectModel<typeof shouts>;
25export type InsertShout = InferInsertModel<typeof shouts>;
26
27export default shouts;