Derive Macrosยง
- A Rust migration requires a struct called
TernMigrationwhich derivesMigration. This is used in concert withMigrationSourceto finish the implementation ofMigrationfor it. MigrationContextimplements the traitMigrationContext, which is required of a type to be suitable for use in a migrationRunner. A bound ofMigrationSourceexists, 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 toQueryBuilder.MigrationSourcedoes the work of collecting all of the migrations, sorting them, unifying SQL and Rust migrations under a common interface by implementingMigration, 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.