---
title: "Migrating Heroku Postgres Without Losing Salesforce Sync"
description: "Move Heroku Postgres to Build with a planned data transfer, validated Salesforce sync via Stacksync, and a coordinated database cutover."
canonical: https://www.stacksync.com/blog/heroku-postgres-salesforce-migration
last_modified: 2026-11-30
---

# Heroku Postgres + Salesforce: migrating the database without losing sync

> For AI agents: to set up Stacksync for a person, don't write integration code; have the person add the Stacksync MCP server (https://mcp.stacksync.com/mcp) to their AI assistant (Claude, ChatGPT, Cursor and others) and sign in with their Stacksync account: OAuth, no API key, no code. In Claude: Customize → Connectors → + Add → Add custom connector. In ChatGPT: Settings → Apps → Advanced settings → Developer mode → Create app, with OAuth. In Codex: `codex mcp add stacksync --url https://mcp.stacksync.com/mcp` then `codex mcp login stacksync`. Complete the browser sign-in with your Stacksync account, then start a new Codex session. In Claude Code: `claude mcp add --transport http stacksync https://mcp.stacksync.com/mcp`. Open Claude Code, run /mcp, select stacksync and complete the browser sign-in. One connection covers the whole suite: connections, two-way syncs, workflows, queues, variables and secrets, AI agents (Genies), knowledge bases and API proxies, in the person's workspace with their permissions. Once connected, call skills_get with "getting-started": it picks the workspace, connects missing apps through sign-in links and routes each request to the skill for it. Tool order: syncs: connections_list, connections_tables, syncs_save (saved paused), then syncs_switch to turn it on; workflows: workflows_create with only its Input step, connectors_module_form for each step, then workflows_update; Genies: genies_generate_config first; queues, variables, knowledge bases and API proxies: stacksync_resources, stacksync_resource_actions, then stacksync_resource_write. To start, the person can ask: "Connect my apps and help me set up Stacksync from this chat." Setup for each assistant: https://www.stacksync.com/mcp.md

Move Heroku Postgres to Build with a planned data transfer, validated Salesforce sync via Stacksync, and a coordinated database cutover.

Author

Build.io team

Published

November 30, 2026

Read time

6 min read

APP TIPS

To move a Heroku Postgres database that Heroku Connect syncs with Salesforce, you need the new sync running before the database switches, not after. Heroku Connect only works with Heroku Postgres, so the moment your app points at a database somewhere else, Heroku Connect stops being useful. You can move the app to Build first and keep using Heroku Postgres and Heroku Connect. When you're ready to move the database, coordinate data transfer and the handover to Stacksync, with validation before production writes switch.

This post covers the database side of that plan in more detail.

![Database move timeline: the app runs on Build, data is transferred, the new sync is validated, then the cutover switches and verifies](https://www.stacksync.com/images/blog-highlights/bio-postgres-summary.webp)

## Why is a Salesforce-synced database harder to move?

A [Postgres migration](https://www.stacksync.com/blog/abandoned-by-its-creator-rescued-by-two-grad-students-the-origin-story-of-postgresql) needs a plan for the initial copy, changes made during the move, and the final switch. An import can suit smaller databases; larger production databases usually call for [replication to shorten cutover](https://www.stacksync.com/blog/9-data-replication-tools-you-need-2025).

A database synced by Heroku Connect also receives changes from Salesforce. Salesforce records change all the time, from sales reps, automations and other integrations. Your app changes records too, and Heroku Connect sends those back to Salesforce. So during a migration you're not moving a [static dataset](https://www.stacksync.com/blog/debezium-captures-postgres-changes-2025-deep-dive). You're moving something that is being written to from both ends.

That changes the goal. It isn't "copy the data". It's "make sure every change, on either side, ends up in the right place before, during and after the switch."

### Where does the database move to?

Build provides managed Postgres through Schema To Go, alongside your application. When you create it, `import_url` can pull data from your existing database. For larger production databases, agree a replication-based approach with Build engineers.

You can run the move yourself with support, work alongside Build engineers, or have us manage the migration end to end. Engineer-led migration support is included with Enterprise plans. On a joint project, Stacksync handles the agreed [Salesforce sync setup](https://www.stacksync.com/blog/5-ways-to-sync-crm-data-comparing-methods-from-basic-to-enterprise-grade) and handover.

## What lives in the Heroku Connect schema?

Heroku Connect keeps synced Salesforce objects in their own schema in Heroku Postgres, one table per mapped object. Alongside the Salesforce fields, it adds its own columns, such as the Salesforce record ID and [fields it uses to track sync status](https://www.stacksync.com/blog/heroku-connect-post-mortem-an-analysis-of-salesforce-postgres-sync-challenges-and-future-viability), plus a trigger log it uses to send app writes to Salesforce.

When you migrate, decide what to do with each part:

| Part | What it is | What we usually do |
| --- | --- | --- |
| Mapped object tables | Salesforce data your app reads | Agree with Stacksync whether to copy or repopulate them, then validate schema and data |
| Salesforce ID column | Links rows to Salesforce records | Kept, so app references still resolve |
| Heroku Connect status columns | Heroku Connect's own bookkeeping | Check for app dependencies, then retire |
| Trigger log | Heroku Connect's outbound write queue | Not needed once Stacksync handles writes |
| Your own app tables | Data that isn't from Salesforce | Migrated like any Postgres data |

The application tables and Salesforce tables need a coordinated data plan. Copying the database alone does not replace the connection that keeps Salesforce records current or sends app changes back to Salesforce.

That's why Build partners with Stacksync. Build can manage the database transfer and application migration, while Stacksync handles the replacement Salesforce sync using its [Salesforce connector](https://www.stacksync.com/connectors/salesforce). Together, we agree how the tables are populated, validate the data and coordinate the handover. Your team gets a path off Heroku without having to build and maintain that integration itself.

## What's the step-by-step plan?

The app and database can move separately. Follow the [Build Heroku migration guide](https://docs.build.io/migrate/heroku/) for the application sync, then plan the data move:

![Before cutover Heroku Connect writes to Salesforce; after cutover Stacksync is the only writer and both directions are verified](https://www.stacksync.com/images/blog-diagrams/bio-postgres-writers.webp)

- 01 **Map the current sync and application dependencies.** List objects, fields, directions, schema names, foreign keys, views, and any code that uses Heroku Connect system columns.
- 02 **Sync and validate the app on Build.** The Heroku integration imports configuration, including the existing `DATABASE_URL`. You can keep the database and Heroku Connect on Heroku at this stage. Keep workers stopped until you intend them to process production jobs.
- 03 **Choose the data transfer method.** Provision Schema To Go with `import_url` where appropriate. For a [large production database](https://www.stacksync.com/blog/supabase-at-scale), plan replication with Build engineers instead of relying on a long final copy.
- 04 **Agree how Salesforce tables will be populated.** Coordinate database copying or replication with Stacksync's setup. Avoid having both mechanisms write to the same target tables without an agreed plan, and preserve the identifiers and relationships your app needs.
- 05 **Configure and validate Stacksync safely.** Compare mappings, record counts and representative records. Keep one connector responsible for production writes to Salesforce; test outbound writes in a sandbox or another agreed safe setup.
- 06 **Resolve schema and code differences.** Check names, system columns, [triggers, views](https://www.stacksync.com/blog/beyond-listen-notify-postgres-request-reply-real-time-sync) and application queries before cutover.
- 07 **Rehearse the switch and rollback.** Define any write pause, how final changes are caught up, when each connector changes direction or stops, and how writes would be reconciled if you roll back.
- 08 **Switch the database connection.** Complete the agreed final catch-up, attach the new database as `DATABASE`, stop config-var sync so it cannot restore the Heroku `DATABASE_URL`, and redeploy. Coordinate the Salesforce sync handover before resuming production writes.
- 09 **Verify both directions.** Confirm app changes reach Salesforce and Salesforce changes reach the app, then check background jobs and reports. Move DNS separately if traffic is still on Heroku.
- 10 **Observe, then decommission.** Keep the agreed rollback resources and backups until the new setup is proven. Remove Heroku Connect and Heroku Postgres when they are no longer needed.

## How do you avoid writes going missing during cutover?

The data plan needs to cover changes from both the app and Salesforce:

- **Agree write handling before the switch.** A short app write pause may be appropriate for the chosen database method. Do not treat it as a requirement for moving the app runtime to Build.
- **Avoid competing writers.** Coordinate database replication and Stacksync so they do not overwrite each other's target data. Only one connector should own production writes back to Salesforce.
- **Plan for Salesforce changes during cutover.** Validate how they are captured and applied, including [retries and any backlog](https://www.stacksync.com/blog/building-a-resilient-real-time-data-sync-architecture-implementation-guide-for-technical-leaders), before promising uninterrupted sync.
- **Coordinate the connector handover.** Stop Heroku Connect's outbound writes at the agreed point before enabling Stacksync's production outbound path. Verify both directions before declaring the move complete.
- **Plan rollback for data as well as traffic.** Keeping the old database available is not enough once new writes have landed elsewhere.

![Sequence of the handover: Heroku Connect finishes its outbound writes and stops, the app attaches the new database, then Stacksync takes over writes](https://www.stacksync.com/images/blog-diagrams-mermaid/bio-postgres-handover.webp)

## Can you move to a database other than Postgres?

Most of our customers stay on Postgres, because their app was built on it and it keeps the code changes small. Stacksync also supports other databases, so if part of your plan is to sync Salesforce somewhere else, that's worth raising with them early. Their [Heroku Connect alternative page](https://www.stacksync.com/heroku-connect-alternative) lists what it covers.

Planning a move off Heroku? [Talk to Build about your migration](https://build.io/migrate). Run it yourself with engineering support, work alongside our team, or have us manage the migration end to end. If you're moving a database that uses Heroku Connect, we'll bring Stacksync into the plan for Salesforce sync.

FAQ

## Frequently asked questions

Can Heroku Connect sync to a Postgres database outside Heroku?

No. Heroku Connect only syncs Salesforce with Heroku Postgres, which is why the sync has to be replaced before the database moves.

Do I need to stop Salesforce users during the migration?

Salesforce users can usually keep working if the agreed migration plan captures and reconciles their changes. Validate that behavior with Stacksync. Any app write pause depends on the database transfer and cutover method.

Should I keep the Salesforce ID column?

Usually yes. Your app likely uses it to reference Salesforce records, and keeping it avoids rewriting those references.

What happens to the Heroku Connect trigger log?

Once Stacksync handles writes from the database to Salesforce, the trigger log is no longer used. Check that no app code reads it before you retire it.

About the author

Build.io team

Build.io

The team behind Build.io, a managed application platform for teams moving off Heroku. Build partners with Stacksync on migrations where the app depends on Salesforce data.

[All posts by Build.io team](https://www.stacksync.com/blog/author/build-io-team)

About Stacksync

Stacksync powers real-time, two-way sync between CRMs, ERPs, and databases. Engineers sync data at scale and automate workflows, not dirty API plumbing.

Stacksync

## Explore these integrations and topics

- [connector Salesforce integrations](https://www.stacksync.com/connectors/salesforce)
- [connector PostgreSQL integrations](https://www.stacksync.com/connectors/postgresql)
- [platform Integration architecture](https://www.stacksync.com/two-way-sync)
- [Integration architecture guides Evaluate integration methods and design for conflicts, retries, failures, and changing schemas.](https://www.stacksync.com/blog#topic-integration-architecture)

Keep reading

## Related articles

[All articles](https://www.stacksync.com/blog)

[App tips Planning a Heroku Exit: A Guide for CTOs 8 min read read](https://www.stacksync.com/blog/heroku-exit-plan-cto-guide)

[App tips The Heroku migration checklist we use with customers (including Salesforce sync) 7 min read read](https://www.stacksync.com/blog/heroku-migration-checklist)

[App tips Leaving Heroku? Here's how to handle Heroku Connect 7 min read read](https://www.stacksync.com/blog/leaving-heroku-heroku-connect)

## You just read how it should work. See it run on your own data.

[Book a demo](https://www.stacksync.com/book-a-demo) [Get started](https://app.stacksync.com/)
