MySQL
MySQL commits each DDL statement as it runs, so a migration that fails half-way leaves the statements before it applied. Keep migrations small and rehearse the release before applying it.
Install
pip install "dblift[mysql]"Connection URL
mysql+pymysql://user:password@localhost:3306/appA plain mysql:// URL is accepted and normalised to mysql+pymysql. Without a URL, DBLift builds one from host, port, database, username and password.
dblift.yaml
database:
type: mysql
url: "mysql+pymysql://db.internal:3306/app"
ssl_enabled: true
connection_timeout: 30
session_variables:
time_zone: "+00:00"Engine settings
ssl_enabledfalseAdds ssl=true to the connection URL.connection_timeout30Sent to the driver as connect_timeout.session_variables{}Rendered into one SET SESSION statement and passed as init_command, so every connection starts the same way.options{}Merged into the URL query string after extra_params, so options wins on a clash.Behaviour notes
A failed migration leaves the statements that already ran in place. The history row is marked failed; clear it with repair once the database is back to a known state.
DBLift folds unquoted names to lowercase. Quote with backticks to keep mixed case.
MySQL rejects UPDATE t … WHERE id IN (SELECT id FROM t) with error 1093, so DBLift wraps the subquery for you.
Introspection closes its own transaction, so reading metadata never leaves a lock behind.
DBLift opens and commits each transaction itself.
A captured server older than 8.0.19 is warned about. Nothing is rendered differently for it.