Declarative schema migrations
Apr 5, 2023Brian Morrison II

Summary
This post introduces the concept of declarative schema migrations, drawing parallels to Infrastructure as Code. It details how tools like the Atlas CLI can be used to define SQL schemas in configuration files, enabling automated application of schema changes. The post discusses the benefits (single source of truth, readability, automation) and drawbacks (potential for conflicts, acting as a crutch for DDL learning) of this strategy. It then outlines how this declarative approach can be integrated with PlanetScale's branching workflow and deploy requests, suggesting a dedicated 'db' repository for schema definition files and automation to apply these changes to development branches before production deployment.