Module Migra_engine.MigrationSource

Sourcetype t = {
  1. version : int64;
  2. description : string;
  3. file_path : string;
}
Sourceval generate_version : unit -> int64
Sourceval parse_version : string -> (int64, Types.error) result
Sourceval parse_description : string -> (string, Types.error) result
Sourceval from_file : string -> (t, Types.error) result

Create a migration record from a file path. Returns Error if the filename doesn't match the expected format.

Sourceval parse_section : string -> string -> string option

Parse a section from migration file content. Extracts content between a section marker (e.g., "-- +migrate up") and the next section. Section matching is case-insensitive.

Sourceval read_up_sql : t -> (string, Types.error) result

Read the up migration SQL from a migration file. Parses the content between -- +migrate up and the next section marker.

Sourceval read_down_sql : t -> (string, Types.error) result

Read the down migration SQL from a migration file. Parses the content between -- +migrate down and the next section marker.

Sourceval checksum : t -> (string, Types.error) result

MD5 checksum (hex) of the migration file's full contents, for detecting whether a migration was modified after being applied.

Sourceval make_filename : int64 -> string -> string

Generate migration filename from version and description. Format: YYYYMMDDHHMMSS_description.sql

Sourceval compare : t -> t -> int
Sourceval to_string : t -> string