<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Expand Contract on StackOnward</title><link>https://stackonward.com/tags/expand-contract/</link><description>Recent content in Expand Contract on StackOnward</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 11 Sep 2026 04:10:00 +0800</lastBuildDate><atom:link href="https://stackonward.com/tags/expand-contract/index.xml" rel="self" type="application/rss+xml"/><item><title>When to Run Database Migrations: Expand, Migrate, Contract</title><link>https://stackonward.com/posts/database-migration-release-order/</link><pubDate>Fri, 11 Sep 2026 04:10:00 +0800</pubDate><guid>https://stackonward.com/posts/database-migration-release-order/</guid><description>&lt;p&gt;When to run database migrations depends on whether the current schema can serve both the old and the new application. Add compatible structure first, ship the new app, then backfill data. Drop columns, finish renames, and tighten constraints in a later release after the old version has left.&lt;/p&gt;
&lt;figure&gt;
 &lt;img src="https://stackonward.com/images/posts/database-migration-release-order/en/expand-migrate-contract.svg" alt="Expand adds compatible structure, Migrate deploys compatible apps and backfills in batches, Contract drops old structure after old consumers exit" loading="lazy" decoding="async"&gt;
 &lt;figcaption&gt;Destructive DDL is not tied to the first rollout of new code.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id="when-to-run-database-migrations-depends-on-compatibility"&gt;When to run database migrations depends on compatibility&lt;/h2&gt;
&lt;p&gt;The same DDL can wait on a lock for seconds or for minutes depending on table size, PostgreSQL major version, and live writes. Confirm those facts, plus how old and new code touch the table, before choosing a stage.&lt;/p&gt;</description></item></channel></rss>