Posts 0.5.0: Long subtitles and slugs no longer crash the post editor
Posts 0.5.0 stops the post editor failing with a server error when a subtitle, repost link or slug is too long for the database, makes inserting pictures work after moving between pages, and gives the module its own migration chain.
Too-long fields get a form error
Three fields were checked against limits that did not match their database columns, so a save passed the form’s checks and then failed with a server error instead of a message:
- The subtitle was allowed 500 characters against a 255-character column. The editor’s own counter offered 500, taken from the subtitle length setting. The editor now caps the title and subtitle counters at what the columns hold, even if the setting is higher.
- The repost link had no length limit at all. It now stops at 255 characters.
- A second post with the same 255-character title got a slug two characters too long. The slug is now shortened to leave room for the number added to keep it unique.
Group and tag slugs typed by hand are also checked against their columns now.
Inserting pictures into a post
Inserting an image or a video into the post body only worked when the editor page was loaded fresh. Coming to the new post page or a post’s edit page from another admin page left it doing nothing. It now works either way.
The publish, move to draft, edit, delete and view buttons in the posts list are now translated into Estonian and Russian.
The module owns its tables
The module’s 13 tables now have their own migration chain. On existing sites the first step changes nothing in the tables: it only records that the module has taken them over. Rolling the chain back never drops a table or deletes posts; the README explains how to remove the tables by hand if you uninstall the module.
Upgrading
Update the dependency, then run mix phoenix_kit.update. It generates one migration for the Posts module, which marks the tables as the module’s own and changes nothing else. The PhoenixKit requirement stays at 2.16 or later.
Full release notes: Posts 0.5.0
0.5.0 · 16 September 2026
Changed
-
The 13
phoenix_kit_post*/phoenix_kit_comment_*tables’ future shape now belongs to a module-owned migration chain,PhoenixKitPosts.Migrations, markerpkpo_schema:<N>onphoenix_kit_posts, following the canonical dual-reader protocol documented byphoenix_kit_hello_worldand used byphoenix_kit_dashboards/phoenix_kit_warehouse(migrated_version/1for migration context,migrated_version_runtime/1formix phoenix_kit.update;up/1re-reads the version before changing anything). Varchar widths are sourced from each owning schema’scolumn_widths/0(Post,PostComment,PostGroup,PostMention,PostTag,PostView) — the single shape authority — never restated as a second number.Ownership unfolds in three phases:
- Phase 0 (this release) — V1 is an adoption, not a create: core’s
V135/V167/V168/V185 baseline still creates all 13 tables (and
phoenix_kit_posts.time_zone) on every install, and V1 re-asserts that exact shape idempotently — every pkey, index, and the full 24-FK set (9 tophoenix_kit_users, 1 self-referential onphoenix_kit_post_comments, 1 tophoenix_kit_post_groups, 1 tophoenix_kit_post_tags, 2 tophoenix_kit_files, 8 tophoenix_kit_posts, 2 tophoenix_kit_post_comments) — and stamps the marker. Because no shape changes, core’sExpectedSchemastays accurate — no core release is required and there is no release-ordering hazard. - Phase 1 (a future V2+) — the first real shape change requires first
adding the altered objects to core’s manifest generator’s
@excluded_exactand regeneratingExpectedSchema, then raising this package’s core floor to that release. Five unique constraints this module’s schemas already assert viaunique_constraint/3but core never backed with an index (post_likes/post_dislikes/post_mentionson(post_uuid, user_uuid),comment_likes/comment_dislikeson(comment_uuid, user_uuid)) are a documented gap left for that first real version, not fixed here. - Phase 2 (a future core baseline squash) — once core stops creating
these tables for fresh installs, V1’s
CREATE TABLEstatements become the only thing that ever creates them from scratch, which is whyup/1already ensuresuuid_generate_v7()(and itspgcryptoextension) exist rather than assuming core’s chain provided them.
down/1can never drop a table, for any target including 0. It unstamps (or re-stamps) the marker onphoenix_kit_postsand nothing else: the rows are every user’s posts, likes, tags, groups, media, mentions, views and legacy comments, and on most installs every table is core-created. Test-pinned — no statement in either direction may matchDROP/TRUNCATE/DELETE. There is deliberately no automated uninstall path; README.md’s new “Removing this module” section gives the operator manual SQL instead.Existing hosts: upgrade, then
mix phoenix_kit.update; it generates aposts_update_v00_to_v01.exsmigration that stampspkpo_schema:1and nothing else changes. New hosts and hosts without this module: unchanged.This is the third of a planned series of similar module-owned-migration adoptions across
phoenix_kit_*packages (afterphoenix_kit_dashboardsandphoenix_kit_warehouse) that today rely entirely on core’s versioned chain for their own tables. - Phase 0 (this release) — V1 is an adoption, not a create: core’s
V135/V167/V168/V185 baseline still creates all 13 tables (and
Added
test/integration/migrations_shape_identity_test.exs— the chain checked against a real database instead of a description of one. Core’s whole chain builds into one schema, V1 builds from scratch into another holding only stubphoenix_kit_users/phoenix_kit_filestables, and every column, index and constraint of the 13 tables is diffed out of Postgres’ own catalogue. The existing manifest comparison is core describing itself; this is the arbiter disagreeing with both if they drift. It is also the only exercise of V1’sCREATE TABLEstatements, which are no-ops on every install until core’s Phase 2 baseline squash makes them the only thing that builds these tables.test/integration/column_width_test.exs— every writablecharacter varying(n)column pinned to its schema’scolumn_widths/0.
Fixed
-
A subtitle, repost URL or generated slug wider than its column no longer 500s the editor. Three
character varyingcolumns were validated against numbers that disagreed with the database, so the changeset reportedvalid?and Postgres then raised22001 string_data_right_truncationon the insert — an unhandledPostgrex.Errorrather than a form error.Post.changeset/2now drives everyvalidate_length/3fromcolumn_widths/0, the same map the migration chain builds its DDL from:sub_titlewas checked against 500 against avarchar(255)column, and the editor’s own character counter andmaxlengthcame fromposts_max_subtitle_length, whose default is 500 — the page actively invited the input that broke it.Web.Editnow clamps both the title and subtitle limits to the real column widths, so a setting above the column is absorbed rather than advertised.repost_urlhad no length bound at all, against avarchar(255)column. A repost URL with a long query string is ordinary.- A second post sharing a 255-character title produced a 257-character
slug:
Slug.ensure_unique/2appended-2to a slug already at the column’s ceiling. Bothslugify/1andunique_slug/2now passmax_length:, which trims the base to make room for the suffix — the hazard core’s ownSlugdocuments. PostGroupandPostTagaccepted an explicit slug wider than their columns (generated ones are safe — they derive from anamecapped at 100).
Posts 0.5.0. Install or update: {:phoenix_kit_posts, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.