Skip to content

Weasel

Open source · Critter Stack

Weasel

Schema management for PostgreSQL, SQL Server, and SQLite

The schema engine underneath Marten, Wolverine, Polecat, and Fisher, usable on its own.

Weasel knows what a table, index, function, or sequence should look like, compares that with what the database actually has, and generates the migration to close the gap. It is why a Critter Stack application can create or update its own schema at startup, in a CLI command, or in CI.

Although it was built for the stack, Weasel works for any .NET application that wants declarative schema management and migration generation on PostgreSQL, SQL Server, or SQLite.

What Weasel Gives You

Schema diffing

Compare the expected schema with the live database and get back exactly the delta.

Migration generation

Produce idempotent migration scripts, apply them in place, or assert that production matches.

Three databases

PostgreSQL, SQL Server, and SQLite from one object model.

The F5 experience

Auto-provisioning on startup so a fresh clone runs with one keypress in development.

Stateful resources

The resource model that lets the JasperFx CLI set up, tear down, and check databases, queues, and brokers.

EF Core migrations

Generate EF Core migrations from the same model when a team needs both.

Start Here

New to Weasel? These 3 posts are the ones to read first, in order.

  1. 1Meet Weasel: The Schema Engine Powering the Whole Critter StackWeasel is the least-famous member of the Critter Stack, but it's the schema-management and SQL-generation engine underneath Marten and Polecat -- and it just became a shared, dialect-neutral runtime for both event stores.
  2. 2Generate EF Core Migrations From Your Real Database Schema with WeaselWeasel can now generate EF Core migrations from a Weasel schema model or an existing database -- bridging Critter Stack schema management into the standard EF Core migrations workflow.
  3. 3Clone, docker compose up, Go: Friction-Free EF Core Integration Testing with Weasel and WolverineWeasel manages the schema for every EF Core DbContext in your application the same way it has always managed Marten's -- and its FK-aware database cleaner plus IInitialData give you a fast, repeatable reset between tests. Clean clone to green test suite with no migration chain to run.

Latest on Weasel

11 posts from the JasperFx blog cover Weasel. Here are the most recent.

Critter Stack in Review: October 12th to 30thCritter Stack in Review: October 12th to 30thThree weeks, 72 tagged releases, and 57 pull requests from 18 people outside JasperFx. The big themes were not losing messages, with a durable inbox and outbox hardening pass that closed a dozen community-reported ways a message could go missing; performance, from SQL Server index seeks to a thread pool thread the run command was quietly eating; shutting down cleanly; an async daemon that heals itself; and multi-tenancy at a scale we'd never tested before. Plus Marten's hard stream delete, Aspire parity in Wolverine, NServiceBus XML interop, and the upgrade notes you should read first.Critter Stack Week in Review: October 5th to 12thCritter Stack Week in Review: October 5th to 12thBobcat went from 0.31 to 0.50 and dropped its Gherkin lane for a projected-only model, WolverineFx.Bobcat shipped, and the whole Event Modeling to specs to scaffolding workflow got a tutorial ahead of tomorrow's live stream. Nineteen pull requests from fourteen people outside JasperFx, headlined by a NATS JetStream hardening pass and a 66 minute leader election brought down to seconds. Plus SQL Server ordered envelope ids, Marten's FetchForWriting consistency fixes, and the LINQ projection surface working under Native AOT.Our Busiest Week Ever: The Critter Stack from September 28th to October 5thOur Busiest Week Ever: The Critter Stack from September 28th to October 5thForty releases, 267 merged pull requests, and 38 of those from eleven people outside JasperFx. Native AOT went from aspirational to measured in CI across Marten, Wolverine, Polecat, and Fisher. Weasel picked up a Firebird provider and a pile of MySQL, Oracle, and SQLite fixes from the Quartz.NET maintainer. Wolverine's global partitioning got hardened by a user running it hard in a real cluster. And Polecat and Fisher kept pace with Marten the whole way.Fisher: A Document Database for Anywhere SQLite is a Good ChoiceFisher gets talked about as the Critter Stack's event store on SQLite, but it's also a full document database that lives in a file inside your own process. If SQLite is the right storage for your application, Fisher is a much lower ceremony way to use it than EF Core: no mapping, no migration files, schema changes that just work through Weasel, and a first class Wolverine integration.Multi-Tenancy with EF Core is a Whole Lot Easier with WolverineEF Core query filters and dynamic connection strings are the raw ingredients for multi-tenancy. Wolverine turns them into a finished dish: conjoined tenancy with zero filter plumbing, database per tenant, tenants added at runtime, HTTP tenant detection that flows straight into DbContext construction, a transactional inbox/outbox per tenant database, tenant ids that ride along on every cascaded message, and 'it just works' schema migrations across every tenant database.Clone, docker compose up, Go: Friction-Free EF Core Integration Testing with Weasel and WolverineWeasel manages the schema for every EF Core DbContext in your application the same way it has always managed Marten's -- and its FK-aware database cleaner plus IInitialData give you a fast, repeatable reset between tests. Clean clone to green test suite with no migration chain to run.

Get help with Weasel

JasperFx builds and maintains Weasel. A support plan gives your team direct access to us; consulting and workshops get a project moving.

The Rest of the Stack