orangeCatDeveloper opened a new issue, #4325: URL: https://github.com/apache/hertzbeat/issues/4325
### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior On a fresh MySQL/PostgreSQL database, Hibernate `ddl-auto` creates the `hzb_sop_schedule` table from the entity before Flyway runs (Flyway is deliberately delayed until after `entityManagerFactory`). `V181__update_column.sql` then executes a bare `CREATE TABLE hzb_sop_schedule`, which fails with "Table 'hzb_sop_schedule' already exists". Flyway records this failure in `flyway_schema_history`, and from then on **every restart aborts during validation**: ``` FlywayValidateException: Validate failed: Migrations have failed validation Detected failed migration to version 181 (update column) ``` The instance can never start again until someone manually deletes the failed row from `flyway_schema_history`. ### Expected Behavior The V181 migration should tolerate objects already created by Hibernate (`CREATE TABLE IF NOT EXISTS` / `CREATE INDEX IF NOT EXISTS`), and a previously recorded failed migration should not permanently prevent startup — Flyway history can be repaired automatically and the (now idempotent) migration retried. ### Steps To Reproduce 1. Point the manager at an empty MySQL (or PostgreSQL) database with `spring.flyway.enabled=true` (default startup config) 2. First boot: Hibernate creates `hzb_sop_schedule`; Flyway's V181 `CREATE TABLE` collides and the failure is recorded in `flyway_schema_history` 3. Restart the manager 4. Startup aborts with `Validate failed ... Detected failed migration to version 181` — and keeps failing on every restart ### Environment ```markdown HertzBeat version(s): master (also reproduced against 1.8.0 schema with MySQL 8 and PostgreSQL 15) ``` ### Debug logs _No response_ ### Anything else? _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
