Expand description
DDL generation for PostgreSQL, SQLite and MySQL.
PostgreSQL and SQLite identifiers are double-quoted (embedded "
doubled). SQLite AlterField / RemoveField / constraint changes rebuild
the table (create new, copy, drop, rename); the migrator disables
foreign keys on the connection before BEGIN. MySQL has its own dialect
(backticks, AUTO_INCREMENT, MODIFY COLUMN, no transactional DDL); see
the mysql module. Other backends return
MigrationError::UnsupportedBackend before any I/O.
Modules§
- mysql
- MySQL / MariaDB DDL (MySQL 8.0.31+).
Structs§
- Sqlite
Cast Check - One SQLite
CASTthat needs a pre-copy loss check:sqlreturns a row when some non-NULL value intable.columnwould change under the cast. - Sqlite
Rebuild Target - SQLite rebuild target for
op: the table being dropped plus the column sets before/after and the index names the rebuild itself recreates.
Functions§
- quote_
ident - Quote
identwith double quotes; embed a quote by doubling it. - quote_
identifier - Quote
identfor the SQL dialect ofkind: backticks for MySQL, double quotes for everything else. - quote_
string - Quote a SQL string literal with single quotes.
- render
- Render a single operation against the current schema
state(before the op). - sqlite_
lossy_ cast_ checks - Columns of
opwhose SQLite rebuildCASTcould lose data. - sqlite_
rebuild_ target - Which table
oprebuilds on SQLite, if any. - sqlite_
sql_ mentions_ ident - Whether
sqlreferences identifierident(a column or table name). - statements
- Render
operationsagainststate, applying each to a cloned state so later ops see earlier ones (needed for SQLite rebuilds).