Skip to content

fix: close Liquibase schema integrity and validation gaps #68

Open

Description

@ohbus

Context

PR #67 introduced Liquibase as the schema owner. The initial implementation starts successfully on a fresh MySQL 8.4 database, but review found integrity and test-validation gaps that will be fixed separately rather than expanding that PR.

Work

  • Add a guarded unique constraint on refresh_tokens.users_id so the database matches the @OneToOne entity mapping and enforces one refresh token per user.
  • Tighten the existing-schema checks for follows(follower_id, following_id) and likes(users_id, posts_id). A unique index with extra columns must not be accepted as the required two-column constraint.
  • Stop tests from letting Hibernate repair the Liquibase schema:
    • map Posts.originalPostId and Posts.replyToId consistently as BINARY(16);
    • change the test profile from ddl-auto=update to ddl-auto=validate.

Acceptance criteria

  • Fresh MySQL schemas enforce one refresh-token row per user.
  • Existing three-column unique indexes do not satisfy either two-column constraint precondition.
  • The test suite passes with Hibernate schema validation and without automatic schema updates.
  • A focused test covers the constraint/precondition behavior.
  • ./mvnw clean verify passes.

Origin

Introduced with the Liquibase baseline in PR #67. Implementation is intentionally deferred to this follow-up issue.

Activity

  1. added
    bug
    on Nov 17, 2026
  2. assigned and unassigned on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions