Skip to content

Commit d692577

Browse files
fix: use programmatic Drizzle migrations and remove Prisma remnants
Replace `bunx drizzle-kit migrate` with a standalone migration script using drizzle-orm's built-in migrate() function, fixing the production Docker deployment where drizzle-kit (a devDependency) was unavailable. Also removes the prisma-archive directory and cleans up all Prisma references from .env.example, eslint.config.js, and README.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7801952 commit d692577

17 files changed

Lines changed: 44 additions & 226 deletions

File tree

.env.example

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# This was inserted by `prisma init`:
2-
# Environment variables declared in this file are automatically made available to Prisma.
3-
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
4-
5-
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
6-
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
7-
81
# PostgreSQL connection string for the database
92
DATABASE_URL="postgres://r00t:t00r@localhost:5432/postgres"
103

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ The app is deployed via **Coolify** using a multi-stage Dockerfile (`oven/bun:1`
106106
### Key files
107107

108108
- `Dockerfile` — Multi-stage build: base → deps → prod-deps → production runtime (no build stage needed)
109-
- `docker-entrypoint.sh` — Runs `bunx drizzle-kit migrate` then starts the app with `bun run src/app.ts`. Set `SKIP_MIGRATIONS=true` to skip.
109+
- `docker-entrypoint.sh` — Runs `bun run src/database/migrate.ts` (programmatic Drizzle migration using `drizzle-orm`, no `drizzle-kit` needed) then starts the app with `bun run src/app.ts`. Set `SKIP_MIGRATIONS=true` to skip.
110110
- `drizzle.config.ts` — Provides database credentials and schema path to Drizzle Kit CLI tools.
111111
- `drizzle/` — Migration SQL files generated by `drizzle-kit generate`.
112112
- `.dockerignore` — Excludes tests, docs, CI config from build context

README.md

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,21 @@ FluffBoost uses Discord slash commands grouped by role.
8989

9090
| Layer | Technology |
9191
| ---------------- | ---------------------------------------- |
92-
| Runtime | Node.js 20.x / 22.x / 24.x |
92+
| Runtime | Bun |
9393
| Language | TypeScript 5.x (strict mode) |
9494
| Discord Library | Discord.js v14 |
95-
| Database | PostgreSQL 16 via Prisma 7 |
95+
| Database | PostgreSQL 16 via Drizzle ORM |
9696
| Job Queue | BullMQ with Redis 7 |
9797
| HTTP Server | Express 5 |
98-
| Containerization | Docker (multi-stage, Node 24 Alpine) |
98+
| Containerization | Docker (multi-stage, Bun) |
9999
| CI/CD | GitHub Actions |
100100
| Deployment | Coolify |
101101

102102
## Development
103103

104104
### Prerequisites
105105

106-
- Node.js 20.x, 22.x, or 24.x
107-
- pnpm 9.x
106+
- Bun
108107
- PostgreSQL 16 (or use Docker Compose)
109108
- Redis 7 (or use Docker Compose)
110109
- A Discord application with bot token
@@ -121,7 +120,7 @@ FluffBoost uses Discord slash commands grouped by role.
121120
2. Install dependencies:
122121

123122
```bash
124-
pnpm install
123+
bun install
125124
```
126125

127126
3. Start local infrastructure:
@@ -136,50 +135,42 @@ FluffBoost uses Discord slash commands grouped by role.
136135
cp .env.example .env
137136
```
138137

139-
5. Generate the Prisma client:
138+
5. Sync the database schema:
140139

141140
```bash
142-
pnpm db:generate
141+
bun run db:push
143142
```
144143

145-
6. Sync the database schema:
144+
6. Start the development server:
146145

147146
```bash
148-
pnpm db:push
149-
```
150-
151-
7. Start the development server:
152-
153-
```bash
154-
pnpm dev
147+
bun dev
155148
```
156149

157150
### Development Scripts
158151

159-
- `pnpm dev` — Start development server with hot reload
160-
- `pnpm build` — Compile TypeScript to `dist/`
161-
- `pnpm start` — Run compiled production build
162-
- `pnpm lint` — Run ESLint with auto-fix
163-
- `pnpm lint:check` — Check linting without fixing
164-
- `pnpm format` — Format code with Prettier
165-
- `pnpm tsc --noEmit` — Run TypeScript type checking
166-
- `pnpm db:generate` — Regenerate Prisma client
167-
- `pnpm db:push` — Sync schema to database (dev)
168-
- `pnpm db:migrate` — Run migrations (production)
169-
- `pnpm db:studio` — Open Prisma Studio UI
170-
- `pnpm test` — Run test suite (216 tests)
171-
- `pnpm test:coverage` — Run tests with c8 coverage
152+
- `bun dev` — Start development server with hot reload
153+
- `bun start` — Run src/app.ts directly
154+
- `bun run lint` — Run ESLint with auto-fix
155+
- `bun run lint:check` — Check linting without fixing
156+
- `bun run format` — Format code with Prettier
157+
- `bun run typecheck` — Run TypeScript type checking
158+
- `bun run db:push` — Sync schema to database (dev)
159+
- `bun run db:generate` — Generate a Drizzle migration
160+
- `bun run db:migrate` — Run migrations (production)
161+
- `bun run db:studio` — Open Drizzle Studio UI
162+
- `bun test` — Run test suite
163+
- `bun test --coverage` — Run tests with coverage
172164

173165
### Code Quality
174166

175167
- ESLint with TypeScript and Airbnb base config
176168
- Strict TypeScript (`noUnusedLocals`,
177169
`noUnusedParameters`, `noImplicitReturns`,
178170
`noUncheckedIndexedAccess`)
179-
- Mocha + Chai + Sinon + esmock test framework
180-
- c8 V8-based code coverage
171+
- bun:test + Sinon test framework
181172
- supertest for HTTP endpoint testing
182-
- CI runs on Node 20.x, 22.x, and 24.x
173+
- CI runs via GitHub Actions with Bun
183174

184175
## Project Structure
185176

@@ -196,15 +187,14 @@ fluffboost/
196187
│ │ ├── owner/ # Owner-only commands
197188
│ │ │ └── premium/ # Test entitlement commands
198189
│ │ └── setup/ # Server setup commands
199-
│ ├── database/ # Prisma client singleton
190+
│ ├── database/ # Drizzle ORM instance and schema
200191
│ ├── events/ # Discord event handlers
201-
│ ├── generated/ # Auto-generated Prisma client
202192
│ ├── redis/ # Redis/IORedis connection
203193
│ ├── utils/ # Shared utilities
204194
│ └── worker/ # BullMQ worker and jobs
205195
│ └── jobs/ # Job handlers
206196
├── tests/ # Test suite (mirrors src/)
207-
├── prisma/ # Prisma schema and migrations
197+
├── drizzle/ # Drizzle migration SQL files
208198
├── Dockerfile # Multi-stage production build
209199
├── docker-compose.yml # Local PostgreSQL + Redis
210200
└── docker-entrypoint.sh # Migration runner for deploy

docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "${SKIP_MIGRATIONS}" = "true" ]; then
55
echo "SKIP_MIGRATIONS=true, skipping database migrations."
66
else
77
echo "Running database migrations..."
8-
bunx drizzle-kit migrate
8+
bun run src/database/migrate.ts
99
echo "Migrations complete."
1010
fi
1111

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ export default [
112112
"*.config.js",
113113
"*.config.ts",
114114
"ecosystem.config.js",
115-
"prisma/migrations/**",
116115
"pnpm-lock.yaml",
117116
"tests/**",
118117
"src/generated/**",

prisma-archive/migrations/20250716060338_init/migration.sql

Lines changed: 0 additions & 40 deletions
This file was deleted.

prisma-archive/migrations/20250716061733_rename_motivation_channel_to_motivation_channel_id/migration.sql

Lines changed: 0 additions & 9 deletions
This file was deleted.

prisma-archive/migrations/20250716063848_refactor_suggestion_quote_relation/migration.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.

prisma-archive/migrations/20250716091429_add_discord_activity_table/migration.sql

Lines changed: 0 additions & 13 deletions
This file was deleted.

prisma-archive/migrations/20250717061117_update_discord_activity_enum/migration.sql

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)