Skip to content

Commit

Permalink
fix: replace kv namespace with d1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucky3028 committed Sep 28, 2023
1 parent 62a3536 commit 27af1bf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions apps/auto-run-ac-api/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import type { DrizzleD1Database } from 'drizzle-orm/d1';
import { parseDecimalInt } from './lib';

export type Env = {
TRIGGERS: KVNamespace;
triggers: D1Database;
TRIGGERS: D1Database;
};

export type Variables = { db: DrizzleD1Database };
Expand Down
2 changes: 1 addition & 1 deletion apps/auto-run-ac-api/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ app.get('/docs', async (c) => {
});

app.use('*', async (c, next) => {
c.set('db', drizzle(c.env.triggers));
c.set('db', drizzle(c.env.TRIGGERS));
await next();
});

Expand Down
6 changes: 1 addition & 5 deletions apps/auto-run-ac-api/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ name = "auto-run-ac-api"
main = "src/worker.ts"
compatibility_date = "2023-08-21"
node_compat = true
kv_namespaces = [
{ binding = "TRIGGERS", id = "fd2cd984832d4e9c91fee320b9993f2e", preview_id = "b81d3e714b3d4d43bd642b55e22a477b" }
]

# TODO: fix binding name
[[d1_databases]]
binding = "triggers" # i.e. available in your Worker on env.DB
binding = "TRIGGERS"
database_name = "triggers"
database_id = "27e105c8-8221-45da-8ffb-4bb0f227ea89"
migrations_dir = "src/db/migrations"

0 comments on commit 27af1bf

Please sign in to comment.