---
title: Models and databases
---

import DocCard from '@theme/DocCard';

Models define what data can be persisted and manipulated by a Marten application. They explicitly specify fields and rules that map to database tables and columns.

## Guides

<div className="row category-index-row">
  <article key="introduction" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/introduction", label: "Introduction", docId: "models-and-databases/introduction" }} />
  </article>
  <article key="queries" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/queries", label: "Queries", docId: "models-and-databases/queries" }} />
  </article>
  <article key="validations" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/validations", label: "Validations", docId: "models-and-databases/validations" }} />
  </article>
  <article key="callbacks" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/callbacks", label: "Callbacks", docId: "models-and-databases/callbacks" }} />
  </article>
  <article key="migrations" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/migrations", label: "Migrations", docId: "models-and-databases/migrations" }} />
  </article>
  <article key="transactions" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/transactions", label: "Transactions", docId: "models-and-databases/transactions" }} />
  </article>
  <article key="raw-sql" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/raw-sql", label: "Raw SQL", docId: "models-and-databases/raw-sql" }} />
  </article>
  <article key="multiple-databases" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/multiple-databases", label: "Multiple databases", docId: "models-and-databases/multiple-databases" }} />
  </article>
</div>

## How-to's

<div className="row category-index-row">
  <article key="create-custom-model-fields" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/how-to/create-custom-model-fields", label: "Create custom model fields", docId: "models-and-databases/how-to/create-custom-model-fields" }} />
  </article>
</div>

## Reference

<div className="row category-index-row">
  <article key="fields" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/reference/fields", label: "Model fields", docId: "models-and-databases/reference/fields" }} />
  </article>
  <article key="table-options" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/reference/table-options", label: "Table options", docId: "models-and-databases/reference/table-options" }} />
  </article>
  <article key="query-set" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/reference/query-set", label: "Query set", docId: "models-and-databases/reference/query-set" }} />
  </article>
  <article key="migration-operations" className="col col--6">
    <DocCard item={{type: "link", href: "./models-and-databases/reference/migration-operations", label: "Migration operations", docId: "models-and-databases/reference/migration-operations" }} />
  </article>
</div>
