Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,29 @@ bun run dev
## Scripts

- `bun run dev` → `wrangler dev --env-file .env`
- `bun run deploy` → deploy worker
- `bun run deploy` → deploy worker locally with `.env`
- `bun run deploy:cf` → apply remote D1 migrations, then deploy Worker for Cloudflare Builds
- `bun run deploy:dry-run` → validate the Worker bundle without deploying
- `bun run cf-typegen` → regenerate `worker-configuration.d.ts`
- `bun run typecheck` → TypeScript check
- `bun run db:generate` → generate Drizzle SQL
- `bun run db:apply:local` / `db:apply:remote` → apply D1 migrations

## CI/CD

Cloudflare Workers Builds deploys pushes to `main`. The deploy command should apply D1 migrations before deploying the Worker:

```bash
bun run deploy:cf
```

Drizzle only generates SQL migrations. Wrangler applies them to D1:

```bash
bun run db:generate
bun run db:apply:remote
```

## Gateway forwarder

The main bot runs as a Cloudflare Worker. Gateway events are forwarded by the Bun app in `forwarder/`, usually running on Krill's machine.
Expand Down
19 changes: 19 additions & 0 deletions drizzle/0001_empty_millenium_guard.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE `claim_requests` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`guild_id` text NOT NULL,
`user_id` text NOT NULL,
`status` text DEFAULT 'submitted' NOT NULL,
`github_username` text,
`merged_pr_count` integer,
`review_message_id` text,
`review_thread_id` text,
`decided_at` text,
`decided_by_id` text,
`decision_reason` text,
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
`updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `idx_claim_requests_guild_user` ON `claim_requests` (`guild_id`,`user_id`);--> statement-breakpoint
CREATE INDEX `idx_claim_requests_user_id` ON `claim_requests` (`user_id`);--> statement-breakpoint
CREATE INDEX `idx_claim_requests_status` ON `claim_requests` (`status`);
Loading