Data

Clone n' Go with Stateful Resources and Weasel

JasperFx (Critter Stack) Blog Jeremy Miller
Data

Jeremy Miller explains how Marten, Polecat, Fisher and Wolverine all sit on Weasel's migration engine: the AutoCreate policy, one IStatefulResource model that covers databases and brokers, and the ways a schema reaches everything from a laptop to a DBA-owned production database.

Key points

  • `AutoCreateSchemaObjects` takes four values: All, CreateOrUpdate (the default), CreateOnly and None.
  • CreateOrUpdate never drops a table, but it does drop columns, indexes and foreign keys that the configuration no longer declares.
  • None skips validation entirely, so drift later surfaces as PostgreSQL's own 42P01 error instead of a clear migration message.
  • `AddResourceSetupOnStartup()` runs Setup() on every stateful resource before other hosted services; `StartupAction.ResetState` also clears state.
  • `RunJasperFxCommands(args)` adds `resources list|check|setup|statistics|clear|teardown` and `check-env`, filterable with `--type` and `--name`.
  • Weasel's `Table.MigrateAsync()` diffs against the catalog and issues only the closing SQL, across six database engines.

Real-world use

  • Teams that want a new developer to clone, run docker compose up -d and hit F5 with no setup wiki
  • Production databases where the application may not run DDL and a DBA owns the schema
  • Schemas that must be exported as patch and drop scripts into existing migration tooling, including EF Core migrations
  • Integration test harnesses where every test host must start from a clean, known state

This summary was generated by the agent from the original post on JasperFx (Critter Stack) Blog. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message