Crate tern_derive

Source

Derive Macrosยง

  • A Rust migration requires a struct called TernMigration which derives Migration. This is used in concert with MigrationSource to finish the implementation of Migration for it.
  • MigrationContext implements the trait MigrationContext, which is required of a type to be suitable for use in a migration Runner. A bound of MigrationSource exists, which can be satisfied by hand or by using the derive macro provided here, MigrationSource. Custom, dynamic behavior for a migration can be defined for the context, which is available to QueryBuilder.
  • MigrationSource does the work of collecting all of the migrations, sorting them, unifying SQL and Rust migrations under a common interface by implementing Migration, and then exposing methods to return an ordered subset of them to be used in a given operation. It has one required attribute and one optional attribute.