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

feat(db): Add --restore argument to yarn db:reset #327

Merged
merged 4 commits into from
May 11, 2022

Conversation

koistya
Copy link
Member

@koistya koistya commented May 11, 2022

As a simplified database migration strategy, you can nuke and reset the database (schema and data) by using:

$ yarn db:backup [--env #0]                            # Creates a backup file (./backups/xxx_{env}.sql`)
$ yarn db:reset [--env #0] [--restore #0] [--no-seed]  # Resets database schema (and data)

...where --env is being set to local by default.

Example 1: Create a backup of the local database (data only) and reset the local db schema an data

$ yarn db:backup
$ yarn db:reset --restore      # or, yarn db:reset --restore=local

Example 2: Create a backup of the test (QA) database and restore it to the local (dev) database

$ yarn db:backup --env=test
$ yarn db:reset --restore=test

@koistya koistya self-assigned this May 11, 2022
@koistya koistya merged commit dd1901c into kriasoft:main May 11, 2022
@koistya koistya deleted the db-reset branch May 11, 2022 16:47
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.

1 participant