Something went wrong. Try again.
A decentralized music tracking and discovery platform built on AT Protocol 🎵 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243import { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm";import { index, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";import tracks from "./tracks";import userStorageProviders from "./user-storage-providers";import users from "./users";
const userUploads = pgTable( "user_uploads", { id: text("xata_id").primaryKey().default(sql`xata_id()`), userId: text("user_id") .notNull() .references(() => users.id), trackId: text("track_id") .notNull() .references(() => tracks.id), r2Key: text("r2_key").notNull(), mimeType: text("mime_type").notNull(), fileSize: integer("file_size").notNull(), originalFilename: text("original_filename").notNull(), /* Audio sample rate in Hz (e.g. 44100), probed from the file at upload time. Nullable: rows uploaded before the column existed. */ sampleRate: integer("sample_rate"), storageProviderId: text("storage_provider_id").references( () => userStorageProviders.id, ), uploadedAt: timestamp("uploaded_at").defaultNow().notNull(), createdAt: timestamp("xata_createdat").defaultNow().notNull(), updatedAt: timestamp("xata_updatedat").defaultNow().notNull(), xataVersion: integer("xata_version"), }, (t) => [ index("user_uploads_user_id_idx").on(t.userId), index("user_uploads_track_id_idx").on(t.trackId), index("user_uploads_user_id_track_id_idx").on(t.userId, t.trackId), ],);
export type SelectUserUpload = InferSelectModel<typeof userUploads>;export type InsertUserUpload = InferInsertModel<typeof userUploads>;
export default userUploads;