Skip to content

The search box knows all the secrets -- try it!

Polecat is part of the Critter Stack ecosystem.

JasperFx Logo JasperFx provides formal support for Polecat and other Critter Stack libraries. Please check our Support Plans for more details.

Database Management

Polecat uses Weasel.SqlServer for all database schema management. Tables are automatically created and updated as needed.

Auto-Create Modes

Control schema management behavior via StoreOptions.AutoCreateSchemaObjects:

ModeBehavior
CreateOrUpdate (default)Creates new tables, adds new columns to existing tables
CreateOnlyOnly creates new tables, never modifies existing ones
NoneNo automatic schema management
cs
opts.AutoCreateSchemaObjects = AutoCreate.CreateOrUpdate;

Schema Objects

Polecat manages these SQL Server objects:

Document Tables

  • pc_doc_{typename} -- One table per document type
  • Created on first use (first Store(), Query(), or LoadAsync())

Event Store Tables

  • pc_events -- Global event log
  • pc_streams -- Stream metadata and snapshots
  • pc_event_progression -- Async daemon progress

Support Tables

  • pc_hilo -- HiLo sequence values for numeric IDs

Default Schema

All tables are created in the dbo schema by default. Change this with:

cs
opts.DatabaseSchemaName = "myschema";

Weasel Integration

Polecat delegates all DDL generation and execution to Weasel.SqlServer. This provides:

  • Diff-based migrations (compares desired vs actual schema)
  • Safe column additions (never drops columns)
  • Index management
  • Foreign key management

PolecatActivator

On application startup, Polecat runs the PolecatActivator which:

  1. Ensures all configured schema objects exist
  2. Runs schema migrations if AutoCreate is enabled
  3. Executes initial data seeding if configured
  4. Starts the async daemon if async projections are registered

Released under the MIT License.