package migra

  1. Overview
  2. Docs
A database migration tool for OCaml supporting PostgreSQL, MariaDB, and SQLite

Install

dune-project
 Dependency

Authors

Maintainers

Sources

migra-1.0.0.tbz
sha256=08ceb8f21f00227f21209484ef1eb8cc326ed26a280747798ec5b0b7c5fdd678
sha512=70050833623ba7801a0a31b1700f5473903335c8db2cdf4de5bbd1876180ec0a93907444b42f7a39b6af454303e0ee5f4c3543ca51378d6324583a26b93f535c

doc/migra.engine/Migra_engine/Database/index.html

Module Migra_engine.DatabaseSource

Sourceval get_hostname : Uri.t -> (string, Types.error) result
Sourceval get_port : Uri.t -> (int, Types.error) result
Sourceval get_database : Uri.t -> (string, Types.error) result
Sourceval get_database_url : unit -> (string, Types.error) result
Sourceval redact_url : string -> string

Replace the password in a connection URL with a fixed ***** mask for safe display (does not reveal the password length).

Sourceval connect_db : string -> (Types.db_conn, Types.error) result Lwt.t

Connect to database using connection string. Returns a single connection (use for one-off operations or transactions).

Sourceval with_db : string -> (Types.db_conn -> 'a Lwt.t) -> ('a, Types.error) Lwt_result.t
Sourceval get_admin_database_url : Dialect.t -> Uri.t -> (string, Types.error) result

Build connection URL for admin database (dialect-aware). Used for creating/dropping databases.

  • parameter dialect

    Database dialect type

  • parameter uri

    Parsed database URL

  • returns

    Admin database connection URL

Sourceval create_database : string -> (unit, Types.error) Lwt_result.t

Create database if it doesn't exist (dialect-aware). For SQLite: Database file created on first connection. For PostgreSQL/MariaDB: Uses admin database to execute CREATE DATABASE.

Sourceval drop_database : string -> (unit, Types.error) Lwt_result.t

Drop database if it exists (dialect-aware). For SQLite: Deletes the database file. For PostgreSQL/MariaDB: Uses admin database to execute DROP DATABASE.