Duansg opened a new pull request, #4368:
URL: https://github.com/apache/hertzbeat/pull/4368

   ## What's changed?
   
   `V182__scope_sop_schedule_owners.sql` fails to apply on PostgreSQL and 
MySQL, so the manager cannot start on either database.
   
   - PostgreSQL: `enabled` maps from a `Boolean` field, so `SET enabled = 0` 
fails with `42804 column "enabled" is of type boolean but expression is of type 
integer`.
   - MySQL: the entity already declares `@Index(name = 
"idx_schedule_creator_conversation")`, so the bare `CREATE INDEX` fails with 
`1061 Duplicate key name`.
   
   V183 is never reached. CI only runs H2, which accepts both statements — 
hence the green builds.
   
   Fix:
   
   - Drop the `CREATE INDEX` statement. The index comes from `@Index` on the 
entity and is created with the table on both the fresh-install and the 1.8.x 
upgrade path, so the migration only duplicated it.
   - Use a boolean literal instead of `0`. On MySQL `FALSE` and `0` are the 
same value, so all three scripts can stay identical.
   
   This assumes `ddl-auto: update` is on, which the manager requires anyway — 
`hzb_auth_token` and the ntfy columns on `hzb_notice_receiver` have no Flyway 
script and are only created by Hibernate.
   
   Verified by running the 1.9.0 package on JDK 25 against PostgreSQL: before, 
startup aborts with `Migration V182__scope_sop_schedule_owners.sql failed / SQL 
State : 42804`; after, Flyway logs `Successfully applied 8 migrations to schema 
"public", now at version v183`. Also checked the scripts directly on PostgreSQL 
16, MySQL 8.0 (`BIT(1)` and `TINYINT`) and H2 2.2.224 — each applies cleanly, 
is safe to re-run, and disables exactly the schedules whose `creator` is NULL 
or blank.
   
   ## Checklist
   
   - [x]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [x]  I have written the necessary doc or comment.
   - [ ]  I have added the necessary unit tests and all cases have passed.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed.
   


-- 
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]

Reply via email to