Skip to content

Sakila

This is the most complete MySQL playbook in the repo: a real sample schema, a before_fk cleanup hook, and an after_all view plus ANALYZE pass.

schema = "sakila"
on_schema_exists = "error"
source_snapshot_mode = "none"
unlogged_tables = false
clean_orphans = true
preserve_defaults = true
add_unsigned_checks = false
replicate_on_update_current_timestamp = false
workers = 4
[source]
type = "mysql"
dsn = "root:root@tcp(127.0.0.1:3306)/sakila"
[target]
dsn = "postgres://postgres:postgres@127.0.0.1:5432/sakila"
[type_mapping]
tinyint1_as_boolean = false
binary16_as_uuid = false
datetime_as_timestamptz = false
json_as_jsonb = true
enum_mode = "check"
set_mode = "text"
sanitize_json_null_bytes = true
unknown_as_text = false
[hooks]
before_data = []
after_data = []
before_fk = ["cleanup.sql"]
after_all = ["post.sql"]
UPDATE {{schema}}.address
SET city_id = NULL
WHERE city_id IS NOT NULL
AND NOT EXISTS (
SELECT 1 FROM {{schema}}.city c
WHERE c.city_id = {{schema}}.address.city_id
);
CREATE OR REPLACE VIEW {{schema}}.film_list AS
SELECT f.film_id, f.title, l.name AS language
FROM {{schema}}.film f
LEFT JOIN {{schema}}.language l ON l.language_id = f.language_id;

Raw files: migration.toml, cleanup.sql, post.sql