Commands

io.eezo.db.cli.Commands
object Commands

The database layer's commands, as library functions. Ported from example/Cli.scala, which was their specification (design/cli.md ยง3); the two rules of layer 1 apply to every entry point here: return values, never print; take capabilities, not connections. The http layer's are in io.eezo.http.cli.Commands, in the same shape.

dbSchema is the Postgres schema commands introspect, defaulting to public the way Introspect.snapshot does. It is a parameter for the same reason Freeze.defaultDbDir is: with it baked in, nothing here could be exercised outside the real database of whatever process is running; the suites isolate by Postgres schema, and pass their own.

freeze takes no capability: it diffs the committed snapshot against the code and writes files, and the live database is deliberately not consulted (that is sync's job). Front ends must not install a Database to run it.

Attributes

Source
Commands.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Commands.type

Members list

Value members

Concrete methods

def ddl(schema: Schema): List[String]

Attributes

Source
Commands.scala
def drop(dbSchema: String = ...)(using Tx): DropResult

Every table in the live schema dropped, and the migration ledger with them.

Every table in the live schema dropped, and the migration ledger with them.

Attributes

Source
Commands.scala
def dump(schema: Schema): String

Attributes

Source
Commands.scala
def freeze(schema: Schema, name: String, decide: Change => Decision, dir: Path = ...): FreezeResult

Drift since the last freeze, written as a numbered, fingerprinted migration.

Drift since the last freeze, written as a numbered, fingerprinted migration.

decide is asked about every change, not only destructive ones: policy belongs to the front end (the interactive one accepts what is safe on its own and prompts on the rest, an agent passes its own), and a mechanism that filtered in advance would leave policies shaped like --skip-destructive nowhere to live.

Attributes

Source
Commands.scala
def migrate(schema: Schema, apply: Boolean, dir: Path = ..., dbSchema: String = ...)(using Tx): MigrateResult

Pending migrations listed, applied when apply, and the database verified against the model once the ledger is settled.

Pending migrations listed, applied when apply, and the database verified against the model once the ledger is settled.

Attributes

Source
Commands.scala
def reset(schema: Schema, dbSchema: String = ...)(using Tx): ResetResult

drop, then the model's full DDL, the same code path migrations take.

drop, then the model's full DDL, the same code path migrations take.

Attributes

Source
Commands.scala
def status(schema: Schema, dbSchema: String = ...)(using DB): StatusResult

The live database against the model, as a diff.

The live database against the model, as a diff.

Attributes

Source
Commands.scala
def sync(schema: Schema, apply: Boolean, force: Boolean, dbSchema: String = ...)(using Tx): SyncResult

The same diff, executed directly when apply: dev only, migrations are the reviewed path.

The same diff, executed directly when apply: dev only, migrations are the reviewed path.

A destructive or risky change refuses an unforced apply, exactly as example/Cli.scala did; force applies everything, including what was blocked.

Attributes

Source
Commands.scala