Which integrity constraint a database refused a write on, read from what the driver reports: SQLState, vendor code and message. H2, PostgreSQL, SQLite and MySQL.
Which integrity constraint a database refused a write on, read from what the driver reports: SQLState, vendor code and message. H2, PostgreSQL, SQLite and MySQL.
Migration SQL written for PostgreSQL, H2 and SQLite, rewritten for MySQL.
The scaffolder writes one migration for every database (BOU-569). MySQL has no UUID or zoned TIMESTAMP type, takes no IF NOT EXISTS on an index, and ignores a REFERENCES written on a column. Only that is rewritten, so SQL written for MySQL passes through as it is.
Migration SQL written for PostgreSQL, H2 and SQLite, rewritten for MySQL. The scaffolder writes one migration for every database (BOU-569). MySQL has no UUID or zoned TIMESTAMP type, takes no IF NOT EXISTS on an index, and ignores a REFERENCES written on a column. Only that is rewritten, so SQL written for MySQL passes through as it is.
Pure functions for SQL query building and transformation.
All functions in this namespace are pure - they take data and return data without side effects. No I/O, logging, or state mutation.
Pure functions for SQL query building and transformation. All functions in this namespace are pure - they take data and return data without side effects. No I/O, logging, or state mutation.
Pure logic for database seeding.
A seed file is EDN, in either of two shapes.
A map of table -> rows, for the simple case:
{:tasks [{:title "Try the admin UI" :done false} {:title "Read AGENTS.md" :done true}]}
Or a vector of [table rows] pairs, which is ordered:
[[:users [{:email "admin@example.com"}]] [:tasks [{:title "Owned by that user" :user-id 1}]]]
Insert order matters as soon as one table references another, and EDN maps only preserve their written order up to 8 entries — a 9th turns the literal into a PersistentHashMap and the order becomes hash order. Rather than let a seed file quietly start inserting children before parents once it grows, a map larger than that is rejected with a pointer to the vector form.
Table and column names are written in kebab-case, like the rest of the codebase; the conversion to snake_case happens here, at the point where the data becomes a persistence concern.
id, created-at and updated-at may be left out; see resolve-seed. A
child names its parent by a symbolic id, a qualified keyword:
[[:invoices [{:id :invoice/acme :number "INV-1"}]] [:invoice-line-items [{:invoice-id :invoice/acme :description "Work"}]]]
Everything in this namespace is pure. Validation returns typed error values rather than throwing — the shell decides how to present them.
Pure logic for database seeding.
A seed file is EDN, in either of two shapes.
A map of table -> rows, for the simple case:
{:tasks [{:title "Try the admin UI" :done false}
{:title "Read AGENTS.md" :done true}]}
Or a vector of [table rows] pairs, which is ordered:
[[:users [{:email "admin@example.com"}]]
[:tasks [{:title "Owned by that user" :user-id 1}]]]
Insert order matters as soon as one table references another, and EDN maps
only preserve their written order up to 8 entries — a 9th turns the literal
into a PersistentHashMap and the order becomes hash order. Rather than let a
seed file quietly start inserting children before parents once it grows, a
map larger than that is rejected with a pointer to the vector form.
Table and column names are written in kebab-case, like the rest of the
codebase; the conversion to snake_case happens here, at the point where the
data becomes a persistence concern.
`id`, `created-at` and `updated-at` may be left out; see `resolve-seed`. A
child names its parent by a symbolic id, a qualified keyword:
[[:invoices [{:id :invoice/acme :number "INV-1"}]]
[:invoice-line-items [{:invoice-id :invoice/acme :description "Work"}]]]
Everything in this namespace is pure. Validation returns typed error values
rather than throwing — the shell decides how to present them.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |