Skip to content

feat: migrate Prisma datasource from SQLite to Supabase PostgreSQL (Phase 1)#6

Merged
brucelikeeat merged 1 commit into
mainfrom
cursor/sqlite-to-supabase-postgres-2f13
May 29, 2026
Merged

feat: migrate Prisma datasource from SQLite to Supabase PostgreSQL (Phase 1)#6
brucelikeeat merged 1 commit into
mainfrom
cursor/sqlite-to-supabase-postgres-2f13

Conversation

@brucelikeeat

Copy link
Copy Markdown
Owner

Phase 1 — Database Migration: SQLite → Supabase PostgreSQL

What this PR does

Migrates the Prisma datasource from SQLite to Supabase PostgreSQL and creates the project launch log.

Changes

File Change
prisma/schema.prisma Provider changed sqlitepostgresql; directUrl = env("DIRECT_URL") added; Account.refresh_token, access_token, id_token annotated @db.Text
.env.example Updated to show PostgreSQL pooler URL format + added DIRECT_URL entry
docs/launch-log.md Created — Phase 1 launch log with step status and full agent log

Schema audit results

  • Account.refresh_token@db.Text — OAuth refresh tokens exceed varchar(191)
  • Account.access_token@db.Text — GitHub OAuth tokens can exceed 191 chars
  • Account.id_token@db.Text — OIDC JWTs are long
  • All DateTime fields use proper DateTime type (no string defaults) ✅
  • No Boolean-as-Int patterns found ✅
  • All 4 NextAuth adapter tables present with correct fields ✅

Steps status

Step Status
1.1 Read current state
1.2 Update datasource block
1.3 Audit + @db.Text fields
1.4 Verify .env URLs ⚠️ blocked — .env was absent, created with placeholders
1.5 Run migration ⚠️ blocked — needs real Supabase URLs in .env
1.6 prisma generate + next build

Action required before merging

The .env file was not present in this environment. It has been created locally (gitignored) with placeholder values. You must fill in your real Supabase connection strings:

DATABASE_URL="postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres?pgbouncer=true"
DIRECT_URL="postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres"

Then run:

npx prisma migrate dev --name switch-to-postgres

Build verification

  • npx prisma generate — ✅ Prisma Client v5.22.0 generated from updated schema
  • npx next build — ✅ all 16 routes compiled, zero Prisma-related errors

Non-Prisma issues found (not fixed per instructions):

  • Leftover [ENV CHECK] debug log fires at build time
  • /api/debug-session route still exists (worklog says it was removed but it remains)
Open in Web Open in Cursor 

- Change datasource provider to 'postgresql' with directUrl support
- Add @db.Text to Account.refresh_token, access_token, id_token
- Update .env.example with PostgreSQL URL format and DIRECT_URL entry
- Create docs/launch-log.md with Phase 1 status and agent log

Co-authored-by: brucelikeeat <brucelikeeat@users.noreply.github.com>
@brucelikeeat brucelikeeat marked this pull request as ready for review May 29, 2026 22:59
@brucelikeeat brucelikeeat merged commit 4bf7690 into main May 29, 2026
@brucelikeeat brucelikeeat deleted the cursor/sqlite-to-supabase-postgres-2f13 branch May 30, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants