ferro-migration
Backend-portable migration helpers for ferro applications using SeaORM.
Example
use backfill_random_hex;
use *;
Postgres backend note
backfill_random_hex on Postgres uses encode(gen_random_bytes(N), 'hex') which
requires the pgcrypto extension. DigitalOcean App Platform managed Postgres has
pgcrypto enabled by default. Self-hosted Postgres may need:
CREATE EXTENSION IF NOT EXISTS pgcrypto;
backfill_random_uuid on Postgres uses gen_random_uuid()::text, which is available
in Postgres 13+ without any extension.
Available helpers
backfill_random_hex(manager, table, column, hex_len)— fills NULL/empty rows with a random hex string ofhex_lencharacters.backfill_random_uuid(manager, table, column)— fills NULL/empty rows with a random UUID v4 string.backfill_current_timestamp(manager, table, column)— fills NULL rows with the current timestamp.backfill(manager, sql_fn)— escape hatch; caller provides a closure returning backend-specific SQL.
SQLite and Postgres are supported. MySQL returns an error.