Database migrations (mabadiliko ya schema) ni mojawapo ya sehemu ngumu zaidi za CI/CD — tofauti na code ya application ambayo haina state, databases huweka state ambayo haiwezi kubadilishwa tu au kurejeshwa. Kushughulikia migrations kwa makini (otomasheni, utumizi wa nyuma-utumiaji, muundo salama) ni muhimu kwa deployments ya kuaminika.
Kwa nini database migrations ni ngumu
App code is stateless (replace it, roll back freely). DATABASES hold STATE:
→ can't just "roll back" a migration that dropped a column or transformed data
(the data may be gone) → rollbacks are risky/impossible for destructive changes
→ during deployment, OLD and NEW app code may run SIMULTANEOUSLY (rolling deploy) —
both must work with the database schema at that moment
→ Schema changes need careful coordination with code deployment.
