Skip to main content

generate_migration_code

Function generate_migration_code 

Source
pub fn generate_migration_code(id: &str, diff: &SchemaDiff) -> String
Expand description

Generates a Rust source string containing a Migration impl for the given diff.

§Arguments

  • id — The migration ID (e.g. "0002_add_email").
  • diff — The schema diff to translate into code.

§Returns

A Rust source string that, when compiled, produces a struct implementing the Migration trait with up() and down() methods.