Repository navigation
Merge post_platforms into posts - #397
Open
paulocastellano wants to merge 8 commits into
Open
paulocastellano wants to merge 8 commits into
paulocastellano wants to merge 8 commits into
Conversation
added 6 commits
October 8, 2026 20:00
Every post now carries its single destination (social account, content type, meta) and its publication result (publish_status, platform post id, URL, error, checkpoints) on its own row. The migrations resolve the legacy rows TryPost 2.0's split left behind, refuse to run while a post still has several destinations, copy each destination onto its post, link analytics publications by post, and drop post_platforms. Code that only existed for posts with several destinations is removed instead of ported, together with the one-off TryPost 2.0 release scripts.
Post cards, the calendar, post details and the failure popover read the channel and publication from the post itself. Edits report meta errors under meta.*, the partially published status and webhook event are gone, and saving a channel-less draft asks for a channel first.
Covers the guard, the legacy cleanup, the backfill (every column, publish time, analytics links, webhook events, parity, re-runs) and the drop. The deploy guide and the project rules now describe posts that carry their own channel.
Every test now builds posts that carry their own channel. Tests of multi-destination posts, disabled destinations, partially published posts and the removed 2.0 release commands are deleted. Fixes found while converting: - single-post writes (API and MCP create, every update) report errors under the post's own keys (meta.*, content_type), not destinations.0.* - the edit composer shows thread reply, Pinterest, Discord and TikTok errors keyed meta.* - a web edit without content_type keeps the stored type again - importing media for an imported post no longer reads an undefined variable - the analytics publication factory writes post_id
MySQL does not wrap migrations in a transaction, so the legacy cleanup was committed before the guard threw. The preparation now runs in one transaction on both engines.
added 2 commits
October 9, 2026 09:30
The production copy has 139 published posts without any destination. They are history whose channel no longer exists, so the preparation deletes them with their media (files removed after commit), quietly, the way disconnecting a channel does.
The backfill took the destination's publish time, which is a second or so before the time the post shows, so 57 cards on the production copy moved. A published post now keeps its own time and falls back to the destination's only when it has none.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
TryPost 2.0 made every post independent per channel, but the data still lived in two tables:
postsandpost_platforms, with exactly one destination per post. This PR moves the destination onto the post row and dropspost_platforms, so there is one place to read and write a post's channel and publication result.What changes
Schema (4 migrations,
2026_10_08_2229*)partially_publishedposts with one destination. It stops with an explanation (pointing tov2.0.0+release:trypost-2) when a post still has more than one destination, a disabled destination published, a published post has no destination, or a destination's account belongs to another workspace.posts:social_account_id,publish_status,platform,content_type,meta, the channel snapshot, the publication fields,publication_updated_at,legacy_target_id. Indexes andanalytics_publications.post_idare added too.post.partially_publishedwebhook subscriptions withpost.published+post.failed. It finishes with a full parity check (counts, scalar columns, JSON, tenancy).analytics_publications.post_platform_idandpost_platforms, after a guard that every row was copied.Model
posts.statusstays the lifecycle.posts.publish_status(App\Enums\Post\PublishStatus) is the network side.partially_publishedis removed.Post::markPublication*()/writePublication(). These movepublication_updated_atand leaveupdated_atalone.posts.errors.choose_channel).Removed
PostPlatform, its factory, observer and resource.postPlatformmorph alias.release:trypost-2,posts:split-legacy-active,posts:audit-legacy,posts:purge-orphaned,posts:bake-aspect-ratio-crops,analytics:backfill-existing.platforms[]. The top level carriespublish_status,social_account,platform,content_type,meta,platform_url,error_messageanddisplay_*.social_account_id/content_type/meta. Sendingplatformsis a 422.meta.*/content_type. Batches keepdestinations.{i}.*.post_idinstead ofpost_platform_id. Each repurpose item post carriesplatform+publish_status.post.*payload, with noerror_context.post.partially_publishedis removed, and stored subscriptions are migrated.DEPLOYMENT.md§4 lists the docs.trypost.it pages to update.Before merging
v2.0.0on the currentmain(311767990). The latest tag isv1.1.0, and self-hosted installs needv2.0.0to runrelease:trypost-2, which this PR removes.Deploy (see
DEPLOYMENT.md)migrate. On the production copy of 2026-10-09 (23,120 posts, 68,022 destinations) the four migrations took 12 s: 45,520 disabled destinations dropped, 1 failed post turned into a draft, 139 published posts without a channel deleted (236 media), every other destination copied with parity.artisan horizon:terminateafter$RESTART_QUEUES().migrateon a production copy first. The first migration tells you if anything still needsposts:split-legacy-active.v1.1.0: must upgrade throughv2.0.0and runrelease:trypost-2first.up.Tests
content_type.partially_published;post_platformsat runtime (ClearGiphySource,CollapseLinkedInContentTypes,RemoveAspectRatioMeta,RemoveChannelPause,PublishLegacyTargetMedia).