A decentralized music tracking and discovery platform built on AT Protocol 馃幍
listenbrainz
spotify
atproto
lastfm
musicbrainz
scrobbling
1import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm";
2import { boolean, pgTable, text, timestamp } from "drizzle-orm/pg-core";
3import users from "./users";
4
5const apiKeys = pgTable("api_keys", {
6 id: text("xata_id").primaryKey().default(sql`xata_id()`),
7 name: text("name").notNull(),
8 apiKey: text("api_key").notNull(),
9 sharedSecret: text("shared_secret").notNull(),
10 description: text("description"),
11 enabled: boolean("enabled").default(true).notNull(),
12 userId: text("user_id")
13 .notNull()
14 .references(() => users.id),
15 createdAt: timestamp("xata_createdat").defaultNow().notNull(),
16 updatedAt: timestamp("xata_updatedat").defaultNow().notNull(),
17});
18
19export type SelectApiKey = InferSelectModel<typeof apiKeys>;
20export type InsertApiKey = InferInsertModel<typeof apiKeys>;
21
22export default apiKeys;