Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Prevent schema.ts and migrations snapshots/sql files from going out of sync.

Type of Change

  • Other: Dev Reliability

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 18, 2025 7:20pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 18, 2025

Greptile Summary

Added a CI check to prevent schema.ts from going out of sync with migration files by running drizzle-kit generate and checking for uncommitted changes in the migrations directory.

  • Runs drizzle-kit generate to regenerate migrations from schema
  • Uses git status --porcelain to detect any new/modified files in ./migrations
  • Provides clear error message with instructions if sync issues detected
  • Issue: Missing DATABASE_URL environment variable that drizzle.config.ts requires

Confidence Score: 3/5

  • Safe to merge after fixing the missing environment variable
  • Good approach to prevent schema drift, but the check will fail without DATABASE_URL env var. Once fixed, this provides valuable CI validation.
  • .github/workflows/test-build.yml needs the DATABASE_URL environment variable added

Important Files Changed

Filename Overview
.github/workflows/test-build.yml Added schema sync check step that validates schema.ts matches migrations, but missing DATABASE_URL env var

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant WD as Working Directory
    participant DK as drizzle-kit
    participant Schema as schema.ts
    participant Mig as migrations/
    
    GH->>WD: cd packages/db
    GH->>DK: bunx drizzle-kit generate
    DK->>Schema: Read schema.ts
    DK->>Mig: Generate migration files
    Note over DK,Mig: Creates .sql and .json snapshots
    GH->>WD: git status --porcelain ./migrations
    alt Changes detected
        WD-->>GH: Modified files found
        GH->>GH: echo error message
        GH->>GH: git diff ./migrations
        GH->>GH: exit 1 (fail CI)
    else No changes
        WD-->>GH: Clean status
        GH->>GH: echo success message
        GH->>GH: Continue workflow
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 merged commit 1720fa8 into staging Dec 18, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/compare-schema-ci branch December 19, 2025 09:28
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