Back
Version 50
7/28/2024
import { sqlite } from "https://esm.town/v/std/sqlite";
import { sql } from "npm:drizzle-orm";
import { drizzle } from "npm:drizzle-orm/libsql";
import { integer, sqliteTable, text } from "npm:drizzle-orm/sqlite-core";
type Track = {
id: number | null;
artist: string;
title: string;
track_id: string | null;
};
const favorites = [
{ artist: "New Order", title: "Blue Monday" },
{ artist: "New Order", title: "Ceremony" },
{ artist: "New Order", title: "True Faith" },
{ artist: "Pixies", title: "Velouria" },
{ artist: "Stone Roses", title: "Fools Gold" },
{ artist: "Primal Scream", title: "Higher than the Sun" },
] as Track[];
export default async function(interval: Interval) {
await sqlite.execute(`drop table if exists favorite_song_searches;`);
await sqlite.execute(`
create table if not exists favorite_song_searches (
id integer primary key autoincrement,
artist text not null,
title text not null,
track_id text,
is_hidden BOOLEAN default FALSE,
UNIQUE(artist, title)
)
`);
const db = drizzle(sqlite as any);
Updated: July 28, 2024