Skip to main content
Version: Next

Marten 1.0.0 release notes

Under development.

Requirements and compatibility​

  • Crystal: 1.20, 1.21, and 1.22.
  • Databases:
    • MariaDB 10.11 and higher.
    • MySQL 8.4 and higher.
    • PostgreSQL 15 and higher.
    • SQLite 3.37.0 and higher.

New features​

Schemas​

Models and databases​

  • Query sets now provide a #each_batch method, allowing to iterate over large query sets in batches without loading all the matching records into memory at once. Records are fetched in batches using a primary key cursor and are always processed in ascending primary key order.
  • Models and query sets now support pessimistic row locking via SELECT ... FOR UPDATE. Query sets provide a #lock method, while model records provide #lock! and #with_lock. See Pessimistic locking for more details.
  • Multi-database projects can now define pluggable database routers via the database_routers setting. Routers resolve which database to use for reads and writes, gate cross-database relations, and control which migrations apply to a given database. Model instances also remember the database they were loaded from or saved to when an explicit #using selection is used.

Development​

  • The serve management command now displays how long project compilation took after each successful build.
  • The new command now writes an AGENTS.md file when creating a project. The file records the Marten version, links to the matching guides and API, and describes the project layout, generators, requires, migrations, CSRF, and specs, so coding agents can work in the generated project. Projects created with --edge link to the in-development guides.
  • The in-development guides are published as a single file at /docs/llms-full.txt, next to the guide index at /docs/llms.txt.
  • The new command prints its usage and exits with status 1 when type or name is omitted and stdin is not a terminal, instead of waiting for prompts. Passing both arguments still runs without prompts.

Backward incompatible changes​

Handlers and HTTP​

  • The default value of the trailing_slash setting is now :remove, so unresolved URLs ending with a trailing slash are permanently redirected to their slashless version by default. Applications that want to keep the previous behavior should explicitly set config.trailing_slash = :do_nothing.