Closed
Conversation
…_watch_entries table creation Root cause: The drizzle-orm migrator tracks applied migrations by timestamp. If a database had a migration applied from another branch (feat/improve-subscription-workflow) with a higher timestamp (idx 55, when=1769741240595), all migrations with lower timestamps get permanently skipped — including the tearful_vertigo migration (idx 54, when=1768684257805) that creates the user_watch_entries table. The migrator would report 'migrations applied successfully!' but create zero new tables. Fix: - Register the previously orphaned add_user_stats_indexes migration in the journal at idx 55 with when=1770120000000 (higher than any stale entry) - Add CREATE TABLE IF NOT EXISTS user_watch_entries as a safety net in this migration, so even if tearful_vertigo (idx 54) was skipped, the table is still created - Remove orphaned SQL files not tracked in the journal: - 20260117160000_create_user_watch_entries_table.sql (manual duplicate) - 20241110183817_watchlist_item_media_type.sql (old orphaned file) - Fix CREATE INDEX CONCURRENTLY to CREATE INDEX IF NOT EXISTS (CONCURRENTLY cannot run inside a transaction, which drizzle-orm uses for migrations) Tested scenarios: - Fresh database: all migrations apply correctly - Stale entry from other branch: user_watch_entries is created by idx 55 Co-authored-by: Luiz Henrique <7henrique18@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Added new localization strings for "Information" and "Name" across multiple languages. - Updated onboarding subtitles to include "Watching" status. - Modified AuthService to include a new displayName parameter in the updateUser method. - Introduced EditNameView for users to update their display name. - Enhanced EditProfileView with tabbed navigation for information, preferences, and settings sections. Co-authored-by: [Your Name] <your.email@example.com>
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.
Describe your changes
Addresses an issue where the
user_watch_entriestable was not created during migrations, despite the terminal reporting success. This was caused by Drizzle ORM's timestamp-based migrator skipping earlier migrations if a database contained a__drizzle_migrationsentry with a future timestamp (e.g., from a different branch).The fix ensures the
user_watch_entriestable is always created by:add_user_stats_indexesmigration into the journal with a new, later timestamp.CREATE TABLE IF NOT EXISTS user_watch_entriesas a safety net within this new migration.CREATE INDEX IF NOT EXISTS(removedCONCURRENTLYfor transaction compatibility).For existing databases with the issue, simply re-running
pnpm db:migratewill apply the fix.Issue ticket number and link
N/A
Checklist before requesting a review
This update ensures database migrations are robust and new tables are created reliably.