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: add SaferMigrations utility for safer column type changes #10891

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Rafael-rgsousa
Copy link

@Rafael-rgsousa Rafael-rgsousa commented May 15, 2024

Description of change

Add SaferMigrations utility to backup and restore data during column type changes. This utility ensures data integrity by backing up specified columns before the migration and restoring them afterward. The utility supports multiple tables and primary key configurations.

Also added tests to validate the backup and restore functionality, including:

  • Basic migration where the column type is modified.
  • Complex migration where the column is dropped and a new column with a different type is added.

Closes: #3357

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@opiredev
Copy link

The user @Rafael-rgsousa has claimed all the rewards in #3357 👀 We've notified the reward creators here.
@Rafael-rgsousa make sure you have your payment account ready to receive the payment for your hard work 💪

feat: add SaferMigrations utility for safer column type changes

Add SaferMigrations utility to backup and restore data during column type changes.
This utility ensures data integrity by backing up specified columns before
the migration and restoring them afterward. The utility supports multiple tables
and primary key configurations.

Also added tests to validate the backup and restore functionality, including:
- Basic migration where the column type is modified.
- Complex migration where the column is dropped and a new column with a different type is added.

Closes: typeorm#3352
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.

Migration generation drops and creates columns instead of altering resulting in data loss
2 participants