State-based approach
Published 08 August 2022
EDITION: TEAMS EDITION: ENTERPRISE
State-based development and state-based deployment
The source of truth of the state of the development database is captured in the schema model on disk. This represents a script for each object and any static data. This schema model is used as the "desired state" for both the purposes of sharing changes within the team and as a source for deployment.
The deployment script is created at deployment time by Flyway's comparison engine and comparing the schema model to a target. Note: that there are complex changes that cannot be inferred by a comparison engine, such as adding new NOT NULL columns without a DEFAULT to tables that contain data, table or column renames, and other changes that require data to be moved or transformed.
The state-based deployment model is suitable for:
- Teams that are manually running their deployments (e.g., don't use an automated CI/CD pipeline).
- Teams using an automated CI/CD pipeline, but do not expect to make "complex" updates to their database that would require a manually-crafted migration script regularly. Teams encountering increasingly complex changes should look at the Combined state and migrations approach.
Required Edition | Flyway Community | Flyway Teams | Flyway Enterprise |
---|---|---|---|
Sharing changes in dedicated development databases | Not supported | Changes shared using schema model | Changes shared using schema model |
Database CI/CD | Not supported | Not supported | Flyway checks available |
Database Deployment | Not supported | Manual state-based deployments allowed | Automated state-based deployments allowed |