···1+import {
2+ numeric,
3+ sqliteTable,
4+ text,
5+ customType,
6+ integer,
7+} from "drizzle-orm/sqlite-core";
89+// string array custom type
10+const json = <TData>() =>
11+ customType<{ data: TData; driverData: string }>({
12+ dataType() {
13+ return "text";
14+ },
15+ toDriver(value: TData): string {
16+ return JSON.stringify(value);
17+ },
18+ })();
000000000000000001920// Tables
21···59 followed: text().primaryKey(),
60 createdAt: text().notNull(),
61});
62+63+// play
64+export const play = sqliteTable("play", {
65+ uri: text().primaryKey(),
66+ authorDid: text().notNull(),
67+ createdAt: text().notNull(),
68+ indexedAt: text().notNull(),
69+70+ /** The name of the track */
71+ trackName: text().notNull(),
72+ /** The Musicbrainz ID of the track */
73+ trackMbId: text(),
74+ /** The Musicbrainz recording ID of the track */
75+ recordingMbId: text(),
76+ /** The length of the track in seconds */
77+ duration: integer(),
78+ /** The name of the artist */
79+ artistName: text().notNull(),
80+ /** Array of Musicbrainz artist IDs */
81+ // type of string[]
82+ artistMbIds: json<string[]>(),
83+ /** The name of the release/album */
84+ releaseName: text(),
85+ /** The Musicbrainz release ID */
86+ releaseMbId: text(),
87+ /** The ISRC code associated with the recording */
88+ isrc: text(),
89+ /** The URL associated with this track */
90+ originUrl: text(),
91+ /** The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com. */
92+ musicServiceBaseDomain: text(),
93+ /** A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b */
94+ submissionClientAgent: text(),
95+ /** The unix timestamp of when the track was played */
96+ playedTime: text(),
97+});