forked from
rocksky.app/rocksky
A decentralized music tracking and discovery platform built on AT Protocol 馃幍
1import type { InferInsertModel, InferSelectModel } from "drizzle-orm";
2import { integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
3import artists from "./artists";
4import users from "./users";
5
6const userArtists = pgTable("user_artists", {
7 id: text("xata_id").primaryKey(),
8 userId: text("user_id")
9 .notNull()
10 .references(() => users.id),
11 artistId: text("artist_id")
12 .notNull()
13 .references(() => artists.id),
14 createdAt: timestamp("xata_createdat").defaultNow().notNull(),
15 updatedAt: timestamp("xata_updatedat").defaultNow().notNull(),
16 xataVersion: integer("xata_version").notNull(),
17 scrobbles: integer("scrobbles"),
18 uri: text("uri").unique().notNull(),
19});
20
21export type SelectUserArtist = InferSelectModel<typeof userArtists>;
22export type InsertUserArtist = InferInsertModel<typeof userArtists>;
23
24export default userArtists;