Skip to main content

MigrationStep

Trait MigrationStep 

Source
pub trait MigrationStep:
    Send
    + Sync
    + 'static {
    // Required methods
    fn from_version(&self) -> u32;
    fn to_version(&self) -> u32;
    fn up(&self, tx: &Tx<'_>) -> Result<()>;

    // Provided method
    fn down(&self, _tx: &Tx<'_>) -> Result<()> { ... }
}
Expand description

수동 코드 스텝 trait — (from,to) 쌍 모델 [C-3] (명세 §8.3)

Required Methods§

Source

fn from_version(&self) -> u32

시작 버전 (명세 [C-3] 확정 이름 — 관례 린트 예외)

Source

fn to_version(&self) -> u32

도착 버전

Source

fn up(&self, tx: &Tx<'_>) -> Result<()>

정방향 실행 — 트랜잭션 안에서 호출된다

Provided Methods§

Source

fn down(&self, _tx: &Tx<'_>) -> Result<()>

역방향(선택) — v1 러너는 up만 실행. down은 사용자 수동 실행용.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§