#Is there any documentation on how to manage the down migrations of the SQL plugin?
7 messages · Page 1 of 1 (latest)
https://docs.rs/sqlx/latest/sqlx/migrate/enum.MigrationType.html
https://v2.tauri.app/plugin/sql/#adding-migrations-to-the-plugin-builder
kind: MigrationKind::Up, << to down , please test it before applying in production project
Tell me if I'm understanding well, do you suggest using a migration with MigrationKind::Up even if it's a down migration?
I am not sure but looks like yes, as I see only up implemented https://github.com/tauri-apps/tauri-plugin-sql/blob/10c441d2e90e5df0e414c40ba81f597b6c38b164/src/plugin.rs#L134 @balmy snow please help, if you can put some light on usages of MigrationKind::Down. thank you
normally on production db if we have to reverse some action, we do add new migrations. in a case where we might have not applied last migrations then applying them to reverse can be avoided by checking while applying very rare occasions as it complicate everything but large db and heavy data moving can be avoided. but I don't think in tauri you can do it directly. 99% cases migrations are used as timeline of truth to record every change and is applied in order on db.
if you are not building very complex app, just create new migration that reverse old one. I was working with one group where they have to keep 500+ migrations, so team decide to do major update and reset db migrations but added complex multiple import logic, once everyone was onbaord on new version they removed all import logic. this all happened without user interactions or actions.
I use down when writing the migration so I can roll back and correct a mistake locally before committing the migration. I thought that it could be very useful when you are developing but I understand your point of view. Thanks for your time