Sakila
Why this example matters
Section titled “Why this example matters”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.
migration.toml
Section titled “migration.toml”schema = "sakila"on_schema_exists = "error"source_snapshot_mode = "none"unlogged_tables = falseclean_orphans = truepreserve_defaults = trueadd_unsigned_checks = falsereplicate_on_update_current_timestamp = falseworkers = 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 = falsebinary16_as_uuid = falsedatetime_as_timestamptz = falsejson_as_jsonb = trueenum_mode = "check"set_mode = "text"sanitize_json_null_bytes = trueunknown_as_text = false
[hooks]before_data = []after_data = []before_fk = ["cleanup.sql"]after_all = ["post.sql"]Cleanup hook excerpt
Section titled “Cleanup hook excerpt”UPDATE {{schema}}.addressSET city_id = NULLWHERE city_id IS NOT NULL AND NOT EXISTS ( SELECT 1 FROM {{schema}}.city c WHERE c.city_id = {{schema}}.address.city_id );Post hook excerpt
Section titled “Post hook excerpt”CREATE OR REPLACE VIEW {{schema}}.film_list ASSELECT f.film_id, f.title, l.name AS languageFROM {{schema}}.film fLEFT JOIN {{schema}}.language l ON l.language_id = f.language_id;Raw files: migration.toml, cleanup.sql, post.sql