Create CET-6 90-day check-in site
This commit is contained in:
commit
5c63f9f120
109 files changed
+19290
No files matched your search
+13
@@ -0,0 +1,13 @@
|
||||
import { env } from "cloudflare:workers";
|
||||
import { drizzle } from "drizzle-orm/d1";
|
||||
import * as schema from "./schema";
|
||||
|
||||
export function getDb() {
|
||||
if (!env.DB) {
|
||||
throw new Error(
|
||||
"Cloudflare D1 binding `DB` is unavailable. Set the `d1` field in .openai/hosting.json to `DB` or let your control plane inject the real binding values before using the database."
|
||||
);
|
||||
}
|
||||
|
||||
return drizzle(env.DB, { schema });
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import { primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
export const progress = sqliteTable("progress", {
|
||||
userId: text("user_id").notNull(),
|
||||
planDate: text("plan_date").notNull(),
|
||||
doneTasks: text("done_tasks").notNull().default("[]"),
|
||||
mood: text("mood").notNull().default(""),
|
||||
note: text("note").notNull().default(""),
|
||||
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
||||
}, (t) => [primaryKey({ columns: [t.userId, t.planDate] })]);
|
||||
Reference in new issue
Block a user