Skip to content

🔴 CRITICAL: Add Flyway for database migrations #1

@GitAddRemote

Description

@GitAddRemote

Problem

Currently using Hibernate ddl-auto=update which is NOT production-safe and can cause data loss. A migration file exists at db/migration/V1__baseline.sql but won't execute without a migration tool.

Solution

  1. Add Flyway dependencies to apps/backend/build.gradle.kts:
implementation("org.flywaydb:flyway-core")
implementation("org.flywaydb:flyway-database-postgresql")
  1. Update application.yml:
spring:
  jpa:
    hibernate:
      ddl-auto: validate  # Change from 'update'
  1. Enable Flyway in application.yml if needed:
spring:
  flyway:
    enabled: true
    baseline-on-migrate: true
  1. Verify existing migration runs successfully

Files to Modify

  • apps/backend/build.gradle.kts
  • apps/backend/src/main/resources/application.yml
  • apps/backend/src/main/resources/db/migration/V1__baseline.sql (verify)

Acceptance Criteria

  • Flyway dependencies added
  • ddl-auto changed to validate
  • Application starts successfully with Flyway
  • V1__baseline.sql migration executes on clean database
  • Existing data not affected on running instance

Priority

🔴 Critical - Must fix before production deployment

Metadata

Metadata

Assignees

No one assigned

    Labels

    criticalCritical priority - must fix before productiondatabaseDatabase relatedproduction-blockerBlocks production deployment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions