Why database migrations?

https://flywaydb.org/getstarted/why

First, let's start from the beginning and assume we have a project called Shiny 

and its primary deliverable is a piece of software called Shiny Soft that connects to a database called Shiny DB.

一个叫做Shiny的项目,有软件还有数据库

The simplest diagram to represent this could look something like this:

 

We have our software and our database. Great. And this could very well be all you need.

But on most projects, this simple view of the world very quickly translates into this:

We now not only have to deal with one copy of our environment, but with several. This presents a number of challenges.

We have been pretty good at solving them on the code side.

  • Version control is now universal with better tools everyday.
  • We have reproducible builds and continuous integration.
  • We have well defined release and deployment processes.

But what about the database?

Well unfortunately we have not been doing so well there.

Many projects still rely on manually applied sql scripts.

And sometimes not even that (a quick sql statement here or there to fix a problem). And soon many questions arise:

  • What state is the database in on this machine?
  • Has this script already been applied or not?
  • Has the quick fix in production been applied in test afterwards?
  • How do you set up a new database instance?

More often than not the answer to these questions is: We don't know.

Database migrations are a great way to regain恢复 control of this mess.

They allow you to:

  • Recreate a database from scratch
  • Make it clear at all times what state a database is in
  • Migrate in a deterministic way from your current version of the database to a newer one

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(230)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2018-03-15 null in JavaScript
2017-03-15 查看计算机型号
2016-03-15 ConfigurationManager.AppSettings Property
2016-03-15 What is a good buffer size for socket programming?
2016-03-15 Protected vs protected internal (Again) in c#
2016-03-15 protected (C# Reference)
2016-03-15 abstract (C# Reference)
点击右上角即可分享
微信分享提示