···9To get started with this template, simply paste this command into your terminal:
1011```bash
12-bun install && bun install -g turbo && cp apps/aqua/.env.example apps/aqua/.env &&
13-bun run db:migrate
14```
15Running on a Mac may also require adding @libsql/darwin-x64 dependency
16
···9To get started with this template, simply paste this command into your terminal:
1011```bash
12+pnpm install && pnpm install -g turbo && cp apps/aqua/.env.example apps/aqua/.env &&
13+pnpm run db:migrate
14```
15Running on a Mac may also require adding @libsql/darwin-x64 dependency
16
···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+ })();
000000000001920// Tables
21···5556// follow relationship
57export const follow = sqliteTable("follow", {
58+ relId: text().primaryKey(),
59+ follower: text().notNull(),
60+ followed: text().notNull(),
61 createdAt: text().notNull(),
62});
63+64+// play
65+export const play = sqliteTable("play", {
66+ uri: text().primaryKey(),
67+ authorDid: text().notNull(),
68+ createdAt: text().notNull(),
69+ indexedAt: text().notNull(),
70+71+ /** The name of the track */
72+ trackName: text().notNull(),
73+ /** The Musicbrainz ID of the track */
74+ trackMbId: text(),
75+ /** The Musicbrainz recording ID of the track */
76+ recordingMbId: text(),
77+ /** The length of the track in seconds */
78+ duration: integer(),
79+ /** The name of the artist */
80+ artistName: text().notNull(),
81+ /** Array of Musicbrainz artist IDs */
82+ // type of string[]
83+ artistMbIds: json<string[]>(),
84+ /** The name of the release/album */
85+ releaseName: text(),
86+ /** The Musicbrainz release ID */
87+ releaseMbId: text(),
88+ /** The ISRC code associated with the recording */
89+ isrc: text(),
90+ /** The URL associated with this track */
91+ originUrl: text(),
92+ /** The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com. */
93+ musicServiceBaseDomain: text(),
94+ /** A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b */
95+ submissionClientAgent: text(),
96+ /** The unix timestamp of when the track was played */
97+ playedTime: text(),
98+});
···310 musicServiceBaseDomain: {
311 type: 'string',
312 description:
313- 'The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com.',
314 },
315 submissionClientAgent: {
316 type: 'string',
317 maxLength: 256,
318 maxGraphemes: 2560,
319 description:
320- 'A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b',
321 },
322 playedTime: {
323 type: 'string',
···310 musicServiceBaseDomain: {
311 type: 'string',
312 description:
313+ "The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com. Defaults to 'local' if not provided.",
314 },
315 submissionClientAgent: {
316 type: 'string',
317 maxLength: 256,
318 maxGraphemes: 2560,
319 description:
320+ "A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b (Linux; Android 13; SM-A715F). Defaults to 'manual/unknown' if not provided.",
321 },
322 playedTime: {
323 type: 'string',
···27 isrc?: string
28 /** The URL associated with this track */
29 originUrl?: string
30- /** The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com. */
31 musicServiceBaseDomain?: string
32- /** A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b */
33 submissionClientAgent?: string
34 /** The unix timestamp of when the track was played */
35 playedTime?: string
···27 isrc?: string
28 /** The URL associated with this track */
29 originUrl?: string
30+ /** The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com. Defaults to 'local' if not provided. */
31 musicServiceBaseDomain?: string
32+ /** A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b (Linux; Android 13; SM-A715F). Defaults to 'manual/unknown' if not provided. */
33 submissionClientAgent?: string
34 /** The unix timestamp of when the track was played */
35 playedTime?: string
···64 },
65 "musicServiceBaseDomain": {
66 "type": "string",
67- "description": "The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com."
68 },
69 "submissionClientAgent": {
70 "type": "string",
71 "maxLength": 256,
72 "maxGraphemes": 2560,
73- "description": "A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b"
74 },
75 "playedTime": {
76 "type": "string",
···64 },
65 "musicServiceBaseDomain": {
66 "type": "string",
67+ "description": "The base domain of the music service. e.g. music.apple.com, tidal.com, spotify.com. Defaults to 'local' if not provided."
68 },
69 "submissionClientAgent": {
70 "type": "string",
71 "maxLength": 256,
72 "maxGraphemes": 2560,
73+ "description": "A user-agent style string specifying the user agent. e.g. tealtracker/0.0.1b (Linux; Android 13; SM-A715F). Defaults to 'manual/unknown' if not provided."
74 },
75 "playedTime": {
76 "type": "string",