Skip to content

Conversation

@CarlyAThomas
Copy link
Contributor

Changes made:

  • Removed isAdminApproved field that was causing schema drift
  • Field was in migration but not in schema.prisma
  • Resolves database sync issues

Checklist:

This is not associated with an issue.

Problem

There is a schema drift issue between the Prisma migration files and the schema definition:

  • The migration file 20220731032911_added_default_role/migration.sql creates the User table with an isAdminApproved field
  • The prisma/schema.prisma file defines the User model without the isAdminApproved field

This mismatch causes Prisma to detect "drift" whenever migration commands are run, because:

  • The migration history says the database should have isAdminApproved
  • The schema (source of truth) says it shouldn't exist

This likely happened when someone removed the field from the schema without creating a DROP COLUMN migration for existing databases.

Solution

Remove the isAdminApproved field from the initial migration file to match the current schema definition. This ensures:

  • New databases won't create this unused column
  • The migration history aligns with the schema
  • No drift warnings when running Prisma commands

Changes

  • Modified prisma/migrations/20220731032911_added_default_role/migration.sql
  • Removed line: "isAdminApproved" BOOLEAN NOT NULL DEFAULT false,

Impact

  • New databases: Won't create the unused column (good)
  • Existing databases: No change - they may still have the column, but it's unused
  • Future cleanup: A separate migration can be created later to drop the column from existing production databases if needed

- Removed isAdminApproved field that was causing schema drift
- Field was in migration but not in schema.prisma
- Resolves database sync issues
@CarlyAThomas CarlyAThomas requested a review from a team as a code owner December 7, 2025 22:19
@utsab
Copy link
Collaborator

utsab commented Dec 9, 2025

Instead of modifying the old migration files, let's just delete them. I'm guessing people have been forgetting to commit the migration files, so the whole migration history is probably botched. Since we haven't pushed to production, it's not a big deal to delete the migration history.

- Removed old migration with isAdminApproved drift issue
- Created fresh migration from current schema.prisma
- Database schema now matches schema definition exactly
- No isAdminApproved field (was causing drift)
- Includes all current schema fields (fccProperUserId, refresh_token_expires_in)
@CarlyAThomas
Copy link
Contributor Author

Closing this due to resolution in #571.

@CarlyAThomas CarlyAThomas deleted the fix/remove-isAdminApproved-drift branch December 9, 2025 04:06
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