Logo Migrondi

ProjectInit Module

Types

Type Description

InitDecision

What the caller should do for a directory, given its state and force.

Functions and values

Function or value Description

applyOverrides config overrides

Full Usage: applyOverrides config overrides

Parameters:
Returns: MigrondiConfig

Applies optional caller-provided fields on top of a base config. An invalid driver value falls back to the base config's driver; callers that must report invalid drivers as errors validate before calling.

config : MigrondiConfig
overrides : ProjectOverrides
Returns: MigrondiConfig

decide isEmpty force

Full Usage: decide isEmpty force

Parameters:
    isEmpty : bool
    force : bool

Returns: InitDecision

`true, _ -> CreateFresh | false, true -> AdoptExisting | false, false -> RefuseNonEmpty`. The destructive clean setup stays CLI-only: the shared layer never deletes a migrations directory.

isEmpty : bool
force : bool
Returns: InitDecision

isDirectoryEmpty path

Full Usage: isDirectoryEmpty path

Parameters:
Returns: bool

True when the directory contains no files and no subdirectories; a missing directory is created and reported as empty.

path : DirectoryInfo
Returns: bool

recoverConfig values

Full Usage: recoverConfig values

Parameters:
    values : Map<string, string>

Returns: MigrondiConfig

Recovers known fields from arbitrary JSON (`Map` view), filling gaps with `MigrondiConfig.Default` — the same recovery the CLI's `--force --merge` performs on partial or invalid files.

values : Map<string, string>
Returns: MigrondiConfig

writeProject directory config

Full Usage: writeProject directory config

Parameters:
Returns: Result<unit, string>

Writes migrondi.json (MiSerializer.Encode — byte-identical to the CLI's WriteConfiguration for the default physical source) and creates the migrations directory. Never deletes anything.

directory : DirectoryInfo
config : MigrondiConfig
Returns: Result<unit, string>

Type something to start searching.