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 Storage

Polecat stores each document type in its own dedicated SQL Server table.

Table Naming

Document tables follow the pattern pc_doc_{typename} where {typename} is the lowercase, simple name of the .NET type. For example:

  • Userpc_doc_user
  • Orderpc_doc_order
  • InvoiceLineItempc_doc_invoicelineitem

Table Structure

A typical document table includes:

sql
CREATE TABLE dbo.pc_doc_user (
    id uniqueidentifier NOT NULL PRIMARY KEY,
    data json NOT NULL,
    type nvarchar(250) NULL,
    last_modified datetimeoffset NOT NULL DEFAULT SYSDATETIMEOFFSET(),
    created datetimeoffset NOT NULL DEFAULT SYSDATETIMEOFFSET(),
    dotnet_type nvarchar(500) NULL
);

Additional Columns

Depending on configuration, additional columns may be present:

ColumnTypeWhen Added
tenant_idnvarchar(250)Conjoined tenancy
is_deletedbitSoft deletes enabled
deleted_atdatetimeoffsetSoft deletes enabled
guid_versionuniqueidentifierIVersioned interface
versionintIRevisioned interface
correlation_idnvarchar(250)Metadata tracking
causation_idnvarchar(250)Metadata tracking

JSON Storage

Document bodies are stored using SQL Server 2025's native json data type. This provides:

  • Server-side JSON validation
  • Efficient JSON_VALUE() extraction for WHERE clauses
  • JSON_MODIFY() for partial updates
  • Compact storage format

Auto-Create Behavior

By default (AutoCreate.CreateOrUpdate), Polecat will:

  1. Create the table if it doesn't exist on first use
  2. Add new columns if the configuration changes (e.g., enabling soft deletes)
  3. Never drop existing columns

See Schema Migrations for more details.

Released under the MIT License.