glimr/db/migrate
Database Migration Utilities
Provides shared types and functions for database migrations. Used by driver packages to load and filter migrations from the filesystem.
Types
Values
pub fn extract_sql(sql: String) -> String
Removes SQL comments from migration content. Strips lines starting with – to clean up the SQL before execution. Returns the trimmed SQL content.
pub fn get_pending_migrations(
all: List(Migration),
applied: List(String),
) -> List(Migration)
Filters migrations to only those that haven’t been applied. Compares against a list of already-applied version strings and returns only the pending migrations.
pub fn load_all_migrations(
connection_name: String,
) -> Result(List(Migration), String)
Loads all migration files from the migrations directory. Reads SQL files from src/data/{connection_name}/_migrations, parses version and name from filenames, and returns sorted by version.