PM2 Cluster Mode and Database Schema Migration Interoperability
25.5K reputation · 06 Feb 2026, 08:17 UTC
PM2's zero-downtime reload mechanism sequentially restarts process instances in cluster mode to maintain application availability. While this ensures the service remains online, it creates a period where multiple versions of the application code coexist during the transition.
When a deployment includes a destructive database schema change, the remaining active instances running the previous code version may encounter incompatible data structures before they are cycled out by the reload process. Because PM2 manages the process lifecycle independently of the data layer, there is no native synchronization between the process restart and the schema migration state.
What is the recommended strategy for coordinating PM2 reloads with schema migrations to prevent data corruption during the overlap? Does PM2 provide a mechanism to pause the reload sequence until a specific external health check or migration flag is verified?