Skip to content

Version 0.8.0

Latest

Choose a tag to compare

@RafaelBarbosatec RafaelBarbosatec released this 27 Oct 00:15
70593e6

Schema synchronization now keeps TypeEnum columns in sync with the model. Adding a value to an enum no longer requires a manual ALTER TABLE: synchronize() reconciles existing columns.

MySQL

  • Reads INFORMATION_SCHEMA.COLUMNS.COLUMN_TYPE and runs ALTER TABLE ... MODIFY COLUMN when the values differ
  • Column attributes (NOT NULL, DEFAULT) are re-applied, because MySQL requires the full definition
  • Labels are compared exactly, so a case-only difference is applied too — a case-sensitive collation would otherwise keep rejecting the model spelling

PostgreSQL

  • Replaces the CHECK constraint generated for the enum (TEXT + CHECK)
  • The constraint is identified through pg_constraint.conkey/pg_attribute, never by matching text in its definition
  • Only standalone single-column enum predicates are replaced; compound and unrelated rules are preserved
  • Drop and add happen in a single ALTER TABLE, so a new CHECK that rejects existing rows leaves the old one in place

Opt-out

  • New synchronize(syncEnumValues: false) for large tables where the ALTER should be scheduled

Also

  • TableSyncronizer now also reads DATA_TYPE/COLUMN_TYPE from INFORMATION_SCHEMA
  • Integration tests run against MySQL 8.0 and PostgreSQL 14 in CI

Upgrade: queryflow: ^0.8.0. No API breaks — existing databases may run a single ALTER on the first synchronization after upgrading when a model enum had drifted from the database.