Rusqlite Migration
Rusqlite Migration is a simple schema migration tool for rusqlite using user_version instead of an SQL table to maintain the current schema version.
It aims for:
- simplicity: define a set of SQL statements. Just add more SQL statement to change the schema. No external CLI, no macro.
- performance: no need to add a table to be parsed, the
user_versionfield is at a fixed offset in the sqlite file format.
Example
Here, we define SQL statements to run with Migrations::new and run these (if necessary) with .to_latest().
use lazy_static;
use ;
use ;
// 1️⃣ Define migrations
lazy_static!
Built-in tests
To test that the migrations are working, you can add this in your test module:
Migrations to previous versions, more detailed examples…
Please see the examples folder for more.
Acknowledgments
I would like to thank all the contributors, as well as the authors of the dependancies this crate uses.