zoukankan      html  css  js  c++  java
  • How does flyway sort version numbers?

    https://stackoverflow.com/questions/19984397/how-does-flyway-sort-version-numbers

    In one word: numerically. As would be expected for a number.

    https://flywaydb.org/documentation/migrations#versioned-migrations

    Versioned Migrations

    The most common type of migration is a versioned migration. Each versioned migration has a version, a description and a checksum. The version must be unique. The description is purely informative for you to be able to remember what each migration does. The checksum is there to detect accidental changes. Versioned migrations are applied in order exactly once.

    Versioned migrations are typically used for:

    • Creating/altering/dropping tables/indexes/foreign keys/enums/UDTs/…
    • Reference data updates
    • User data corrections

    Here is a small example:

    CREATE TABLE car (
        id INT NOT NULL PRIMARY KEY,
        license_plate VARCHAR NOT NULL,
        color VARCHAR NOT NULL
    );
    
    ALTER TABLE owner ADD driver_license_id VARCHAR;
    
    INSERT INTO brand (name) VALUES ('DeLorean');
    

    Each versioned migration must be assigned a unique version. Any version is valid as long as it conforms to the usual dotted notation. For most cases a simple increasing integer should be all you need. However Flyway is quite flexible and all these versions are valid versioned migration versions:

    • 1
    • 001
    • 5.2
    • 1.2.3.4.5.6.7.8.9
    • 205.68
    • 20130115113556
    • 2013.1.15.11.35.56
    • 2013.01.15.11.35.56

    Versioned migrations are applied in the order of their versions. Versions are sorted numerically as you would normally expect.

  • 相关阅读:
    动态表格
    Palindrome Number
    String to Integer (atoi) ???
    Reverse Integer
    Two Sum
    Path Sum
    Minimum Depth of Binary Tree
    Plus One
    Maximum Depth of Binary Tree
    Symmetric Tree
  • 原文地址:https://www.cnblogs.com/chucklu/p/10402905.html
Copyright © 2011-2022 走看看