Cyclium. Migrations. V19
(Cyclium v0.1.5)
Copy Markdown
V19: Convert legacy SQL Server TEXT columns to nvarchar(max) so emoji and
other non-CP1252 characters round-trip correctly. No-op on Postgres/SQLite.
Background
Earlier migrations declared columns with Ecto's :text type. On Postgres and
SQLite this maps to UTF-8 TEXT and preserves any Unicode. On the Tds
adapter, :text falls through the catch-all type mapping in
ecto_sql's Ecto.Adapters.Tds.Connection and emits the literal SQL Server
TEXT type — a legacy, collation-bound, non-Unicode type (deprecated since
SQL Server 2005). On a CP1252 collation (the default on many installs),
characters outside the codepage — emoji, CJK, most non-Latin scripts — are
silently replaced with ? on write.
This migration alters every affected column to nvarchar(max) on SQL Server
only. Rows already stored as ? remain lost; the migration unblocks future
writes.
Notes
ALTER COLUMN text -> nvarchar(max)converts rows in place but is not online — it takes a schema lock proportional to table size. Consumers with largecyclium_episode_logstables should plan maintenance accordingly.- Nullability is preserved (
cyclium_workflow_definitions.stepsisNOT NULL; everything else is nullable). - None of the target columns are indexed today, and
nvarchar(max)can't participate in a regular B-tree index anyway — same astextcouldn't.