zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    nginx源码分析:module机制
    Linux源码分析之:malloc、free
    shell格式化字符串
    shell执行字符串中的命令
    docker安装并运行mongo
    docker安装并运行kibana
    docker安装并运行elasticsearch
    docker安装并运行rabbitmq
    docker安装并运行ngnix
    docker安装并运行redis
  • 原文地址:https://www.cnblogs.com/chucklu/p/10538939.html
Copyright © 2011-2022 走看看