Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common errors and Solutions of Flyway version Management Database

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Flyway is a database versioning management tool that automates DB Migration upgrades through SQL scripts, supports independent operation, and can also be integrated with build tools or Spring development environments.

Summarize common mistakes in the actual development process and share solutions and suggestions:

L migrate failed to run, prompting sql script error

Solution: run the flyway command repair independently to repair the upgrade information in the database, correct the SQL error and migrate again

Recommendation: before running migrate, make sure that SQL is correct.

L migrate did not run the added SQL script

Solution: SQL script naming follows rules, such as V1.0.0__init.sql

L migrate failed to run, indicating insufficient permissions, "xxx command denied to user 'xxx'"

Solution: the account needs to have the permissions required for the corresponding sql script, such as create table

L migrate failed to run, indicating that the database is not empty, "Found non-empty schema (s)"

Solution: follow the prompts to run the flyway command baseline initialization independently.

Suggestion: empty the database and initialize it from the empty database.

L prompt that the database cannot be found, "unkown database 'xxx'"

Solution: you need to create an empty database first.

L Spring failed to start after integrating Flyway, emptying data

Solution: confirm validationQuery, whether select 1 from dual or a specified data table. Use dual when the database is empty

Error in startup operation after Spring integrates Flyway

Solution: some database-dependent bean needs to be specified to run after Flyway completes the migrate

L SQL script V1.0__xxx.sql was not run

Solution: Flyway uniquely distinguishes scripts by version number. If you run baseline,Flyway at the beginning, version 1.0 will be created automatically

Suggestion: 1. Initialize from empty database and do not run baseline.

Recommendation: 2, initialize the SQL script version number from V1.0.1, using three digits.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 285

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report