SkillDevs / electric_dart

A Dart implementation for Electric (electric-sql.com).
Apache License 2.0
104 stars 9 forks source link

Schema versioning conflicts #2

Open maximblack opened 1 year ago

maximblack commented 1 year ago

When performing an update of Electric service (with new migration schemas for Postgres) + deploying a new Flutter app (that matches new schemas), some app users will still have the old version of the app

Now, the lib fetches the migrations (for sqlite dialect) from Electric service, on App startup, and apply them on the local sqlite db

The problem The old app may not work with the new schema

The possible solution I'm still reshaping my brain to think Offline first, does forward/additive migration planning will cover such cases?

davidmartos96 commented 1 year ago

As long as the migration is additive (new columns with default values, or a new table), the synchronization protocol that Electric uses should send the Migration over the wire and the old client would update automatically.

Non additive migrations (a migration that would make an old client break) are currently not supported. I believe the Electric team is designing some alternatives for such cases.

For a more detailed response consider asking the Electric team over Discord.