Build business demand registration workspace from SOP
This commit is contained in:
commit
2149aeb6ed
126 files changed
+25399
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,5 @@
|
||||
import { sqliteTable, text, integer, index } from 'drizzle-orm/sqlite-core';
|
||||
export const demands = sqliteTable('demands', {
|
||||
id: text('id').primaryKey(), ownerId: text('owner_id').notNull(), payload: text('payload').notNull(),
|
||||
revision: integer('revision').notNull().default(1), updatedAt: text('updated_at').notNull(),
|
||||
}, table => [index('idx_demands_owner_updated').on(table.ownerId, table.updatedAt)]);
|
||||
Reference in new issue
Block a user