error when running with PostgreSQL #129
-
|
I'm getting a "relation does not exist" error when running with PostgreSQL. How do I set up the database schema? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
This means the database tables haven't been created yet. Chamaa.API uses Flyway for database migrations in production. Here's how to fix it: Option 1: Let Flyway Handle It (Recommended)Make sure your spring.flyway.enabled=true
spring.jpa.hibernate.ddl-auto=validateFlyway will automatically run migration scripts from Option 2: Manual SetupIf you're setting up PostgreSQL manually: # Create the database
psql -U postgres -c "CREATE DATABASE chamaa_db;"
# Run migrations manually
cd apps/backend
./mvnw flyway:migrate -Dflyway.url=jdbc:postgresql://localhost:5432/chamaa_dbOption 3: Quick Dev Setup with H2For local development, skip PostgreSQL entirely and use H2: ./mvnw spring-boot:run -Dspring-boot.run.profiles=devThe Common Pitfalls
|
Beta Was this translation helpful? Give feedback.
This means the database tables haven't been created yet. Chamaa.API uses Flyway for database migrations in production. Here's how to fix it:
Option 1: Let Flyway Handle It (Recommended)
Make sure your
application-prod.propertiesor environment variables are set:Flyway will automatically run migration scripts from
src/main/resources/db/migration/on startup.Option 2: Manual Setup
If you're setting up PostgreSQL manually:
Option 3: Quic…