当前位置:网站首页>[flyway introduction]

[flyway introduction]

2022-07-24 00:50:00 gaojingsong

1、Flyway Introduce
Official website address :https://flywaydb.org/documentation/
Flyway is an open-source database migration tool. It strongly favors simplicity and convention over configuration.
Flyway Is a Open source database version management tool . It strongly supports simplicity and conventions , Not configuration .

It is based around just 7 basic commands: Migrate, Clean, Info, Validate, Undo, Baseline and Repair.
around 7 It's a basic order :Migrate, Clean, Info, Validate, Undo, Baseline and Repair.

Migrations can be written in SQL (database-specific syntax (such as PL/SQL, T-SQL, ...) is supported) or Java (for advanced data transformations or dealing with LOBs).

It has a Command-line client. If you are on the JVM, we recommend using the Java API for migrating the database on application startup. Alternatively, you can also use the Maven plugin or Gradle plugin.
It has a command-line client . If you are in JVM On , We recommend using Java API Migrate database . perhaps , You can also use the Maven Plug-in or Gradle plug-in unit .

And if that's not enough, there are plugins available for Spring Boot, Dropwizard, Grails, Play, SBT, Ant, Griffon, Grunt, Ninja and more!

Supported databases are Oracle, SQL Server (including Amazon RDS and Azure SQL Database), Azure Synapse (Formerly Data Warehouse), DB2, MySQL (including Amazon RDS, Azure Database & Google Cloud SQL), Aurora MySQL, MariaDB, Percona XtraDB Cluster, TestContainers, PostgreSQL (including Amazon RDS, Azure Database, Google Cloud SQL, TimescaleDB, YugabyteDB & Heroku), Aurora PostgreSQL, Redshift, CockroachDB, SAP HANA, Sybase ASE, Informix, H2, HSQLDB, Derby, Snowflake, SQLite and Firebird.

Supported databases include Oracle、SQL Server( Include Amazon RDS and Azure SQL database )、Azure Synapse( The former data warehouse )、DB2、MySQL( Include Amazon RDS、Azure Database and Google Cloud SQL)、Aurora MySQL、MariaDB、Percona XtraDB Cluster、TestContainers、PostgreSQL( Include Amazon RDS、Azure Database、Google Cloud SQL、TimescaleDB、YugabyteDB and Heroku)、Aurora PostgreSQL、Redshift、,CockroachDB、SAP HANA、Sybase ASE、Informix、H2、HSQLDB、Derby、Snowflake、SQLite and Firebird.

Flyway It can manage and track database changes independently of applications , Support automatic upgrade of database version , And there is a default protocol , No complex configuration required ,Migrations It can be written. SQL Script .
Flyway Version management of database is mainly composed of Metadata Table and 6 Command completion ,

2. Flyway The characteristics of
Flyway Its popularity is due to the following advantages :

Simple It's easy to install and learn , At the same time, the way of migration is easily accepted by developers .
focus Specifically for database migration 、 Version control without any other reaction .
Powerful Designed for continuous delivery , Give Way Flyway Migrate the database when the application starts .

3. Flyway How it works
Flyway It needs to be in DB First of all, create a metadata surface ( The default table name is flyway_schema_history), Every time... Is saved in this table migration ( transfer ) The record of , The record contains migration The version number of the script and SQL The script checksum value .

flyway Command line
flyway Provide command line tools , Common commands include :
Clean: Delete all created database objects , Include users 、 surface 、 View etc. . Be careful not to execute... On the production library clean operation .
Migrate: Apply version changes to the database in turn .
Info: Get the status of the current database . Those migrations have been completed , Those migrations are to be completed . Execution time and results of all migrations .
Validate: Verify that Apply Is there any change in the script of , Flyway Of Migration Do it first by default Validate.
Baseline: Generate a benchmark migration script based on the existing database structure .
Repair: Repair command try not to use , The restoration scene has : 1. Remove the failed migration Record . 2. What has been applied SQL The script was modified , We want to re apply the SQL Script .

原网站

版权声明
本文为[gaojingsong]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/205/202207240046368239.html