Conversation
- Create 0001_initial.sql with base schema (tables without interview fields) - Keep 0002_interview_fields.sql for adding new columns - Update deploy-worker.yml to use 'd1 migrations apply' - Update justfile worker-migrate to use migrations This fixes the 'no such column: lead_tier' error when deploying to a production database that was created before interview fields were added.
There was a problem hiding this comment.
Pull request overview
This PR migrates the worker database setup from direct SQL file execution to D1's migration system to fix a deployment issue where new columns were missing in production. The migration system tracks applied changes, ensuring existing tables are properly updated with new columns rather than skipped by CREATE TABLE IF NOT EXISTS statements.
Key Changes:
- Creates structured D1 migrations (
0001_initial.sqlfor base schema,0002_interview_fields.sqlfor new columns) - Updates deployment commands in GitHub Actions and justfile to use
d1 migrations applyinstead of direct SQL execution
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| workers/chat-api/migrations/0001_initial.sql | Initial migration containing base schema for sessions, messages, and leads tables |
| justfile | Updated worker-migrate command to use D1 migrations API across all environments |
| .github/workflows/deploy-worker.yml | Updated deployment workflow to apply migrations instead of executing raw SQL |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
vibes-website | 2e15bb4 | Commit Preview URL Branch Preview URL |
Dec 25 2025, 12:36 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
schema.sqlexecution to D1 migrations0001_initial.sqlwith base schema (original tables)0002_interview_fields.sqlfor adding interview columnsd1 migrations applyProblem
The worker deploy was failing with
no such column: lead_tierbecause:CREATE TABLE IF NOT EXISTSdoesn't update existing tablesSolution
D1 migrations track which migrations have been applied:
Test Plan