Rusqlite Migration

Rusqlite Migration

Rusqlite Migration is a simple schema migration library 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_version field is at a fixed offset in the sqlite file format.

It works especially well with other small libraries complementing rusqlite, like serde_rusqlite.

Example

Here, we define SQL statements to run with Migrations::new and run these (if necessary) with .to_latest().

Please see the examples folder for more, in particular:

  • migrations with multiple SQL statements (using for instance r#"…" or include_str!(…))
  • use of lazy_static
  • migrations to previous versions (downward migrations)

I’ve also made a cheatsheet of SQLite pragma for improved performance and consistency.

Built-in tests

To test that the migrations are working, you can add this in your test module:

Contributing

Contributions (documentation or code improvements in particular) are welcome, see contributing!

Acknowledgments

I would like to thank all the contributors, as well as the authors of the dependencies this crate uses.

Issues

Collection of the latest Issues

cljoly

cljoly

documentation
0

As someone who isn’t the author of this, you have super powers! You can see what is unclear in the documentation.

So please, when you try to use this library, if you notice anything unclear in the README or the docs, comment on this issue or open a PR, so that other people would find their way more easily. Thanks a lot!

Versions

Find the latest versions by id

v1.0.0 - Mar 27, 2022

Version 1.0.0

Breaking changes

  • Remove deprecated symbols (Migrations.latest, SchemaVersionError::MigrateToLowerNotSupported)

Other

  • Documentation improvements

v0.5.1 - Dec 03, 2021

Version 0.5.1

Potentially Breaking Changes

Other

  • Improve the documentation

v0.5.0 - Dec 03, 2021

Potentially breaking change

  • Update the env_logger dependency

Other

  • Improve the documentation

v0.4.2 - Apr 17, 2021

Only documentation changes.

v0.4.1 - Apr 17, 2021

Only documentation changes.

v0.4.0 - Apr 06, 2021

New features

  • Add downward migrations, i.e. migrations to go to past schema version of the database. Thanks @MightyPork!
  • Unsafe code is now forbidden.

Breaking changes

  • Rename latest to to_latest. The old symbol is deprecated and will be removed eventually.
  • An error is now returned when a migration is attempted while no migrations exist.

Other

  • Improve general rust API documentation.
  • Generate parts of the readme based on rust comments, for increased consistency with the docs.rs content.
  • Various refactoring and clean-ups.

v0.3.1 - Mar 14, 2021

Fix in readme, for crates.io

v0.3 - Mar 14, 2021

New features

  • Multi line sql statements like:

    are now fully supported

Other

  • Various doc & CI improvements
  • Fix a case of failure with silent errors.

Information - Updated May 14, 2022

Stars: 20
Forks: 3
Issues: 1

Rust library for Self Organising Maps (SOM)

Add rusticsom as a dependency in Cargo

Rust library for Self Organising Maps (SOM)

Rust library for parsing configuration files

The 'option' can be any string with no whitespace

Rust library for parsing configuration files

Rust library for the Pimoroni Four Letter pHAT

This library aims to port ht16k33 (or rather a fork, as of right now) so credit goes to ht16k33-diet

Rust library for the Pimoroni Four Letter pHAT

Rust library for emulating 32-bit RISC-V

This library can execute instructions against any memory and register file that implements

Rust library for emulating 32-bit RISC-V

Rust library for connecting to the IPFS HTTP API using Hyper/Actix

You can use actix-web as a backend instead of hyper

Rust library for connecting to the IPFS HTTP API using Hyper/Actix

Rust library to manipulate file system access control lists (ACL) on macOS, Linux, and FreeBSD

This module provides two high level functions, getfacl and setfacl

Rust library to manipulate file system access control lists (ACL) on macOS, Linux, and FreeBSD

Rust library translation (rust-src/rust-std/stdlib/rustlib translation)

This is the place to translate Having a documentation in your native language is essential if you don't speak English, and still enjoyable even if...

Rust library translation (rust-src/rust-std/stdlib/rustlib translation)

Rust library for using Infrared hardware decoders (For example a Vishay TSOP* decoder),

enabling remote control support for embedded project

Rust library for using Infrared hardware decoders (For example a Vishay TSOP* decoder),

Rust library for interaction with the OriginTrail Decentralized Knowledge Graph

open up an issue on this repository and let us know

Rust library for interaction with the OriginTrail Decentralized Knowledge Graph

Rust library for parsing COLLADA files

Notice: This library is built around files exported from Blender 2

Rust library for parsing COLLADA files

Rust library for low-level abstraction of MIPS32 processors

This project is licensed under the terms of the MIT license

Rust library for low-level abstraction of MIPS32 processors
Facebook Instagram Twitter GitHub Dribbble
Privacy