Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make database migrations work #746

Merged
merged 2 commits into from
Aug 28, 2024
Merged

fix: make database migrations work #746

merged 2 commits into from
Aug 28, 2024

Conversation

BlankParticle
Copy link
Member

@BlankParticle BlankParticle commented Aug 26, 2024

What does this PR do?

Fixing database migrations

Need to test on a copy of production db first

Prerequisites

  • Get the schema dump for current database on production and match it with the 0000 migration. Make sure that the starting state for the database and the migration are same and everything is same in schema and database.
  • If there is anything different between production database and schema/migration file, decide which one is correct and modify the schema or production db respectively to make sure both are in same state before we mark 0000 as migrated.

How to merge this PR

  • if there is a table called __drizzle_migrations, drop that
  • make a table with this command
create table if not exists `__drizzle_migrations` (
                                id serial primary key,
                                hash text not null,
                                created_at bigint
                        )
  • Insert a new record with id as 1, created_at as same as shown in migrations/meta/_journal.json#entires[0].when, hash being the sha256 string of the 0000_*.sql file
  • Merge the PR

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

Required

  • Read Contributing Guide
  • Self-reviewed my own code
  • Tested my code in a local environment
  • Commented on my code in hard-to-understand areas
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the UnInbox Docs if changes were necessary

@BlankParticle BlankParticle mentioned this pull request Aug 26, 2024
16 tasks
Copy link
Member Author

BlankParticle commented Aug 26, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @BlankParticle and the rest of your teammates on Graphite Graphite

@BlankParticle BlankParticle marked this pull request as ready for review August 26, 2024 13:40
@BlankParticle BlankParticle changed the base branch from blank/chore/update-deps-25-08 to graphite-base/746 August 27, 2024 18:04
@BlankParticle BlankParticle changed the base branch from graphite-base/746 to main August 27, 2024 18:06
@ashgansh ashgansh merged commit a346efd into main Aug 28, 2024
4 checks passed
@BlankParticle BlankParticle deleted the blank/fix/db-migrations branch August 28, 2024 13:21
@BlankParticle BlankParticle mentioned this pull request Aug 30, 2024
16 tasks
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.

None yet

2 participants