Fix flyway migration and use h2 in unit tests.
All checks were successful
Backend CI / Run Maven Tests (pull_request) Successful in 27s
All checks were successful
Backend CI / Run Maven Tests (pull_request) Successful in 27s
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
CREATE SCHEMA IF NOT EXISTS vibing;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS vibing.locations (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
address TEXT,
|
||||
city TEXT,
|
||||
country TEXT,
|
||||
postal_code TEXT,
|
||||
latitude DOUBLE PRECISION,
|
||||
longitude DOUBLE PRECISION,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS vibing.activities (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
@@ -20,17 +33,3 @@ CREATE TABLE IF NOT EXISTS vibing.activity_tags (
|
||||
FOREIGN KEY (activity_id) REFERENCES vibing.activities(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (activity_id, tag)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS vibing.locations (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
address TEXT,
|
||||
city TEXT,
|
||||
country TEXT,
|
||||
postal_code TEXT,
|
||||
latitude DOUBLE PRECISION,
|
||||
longitude DOUBLE PRECISION,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
|
||||
@@ -2,15 +2,17 @@ package com.vibing.backend;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
/**
|
||||
* Basic test class for the Vibing Backend application.
|
||||
*/
|
||||
@SpringBootTest
|
||||
@ActiveProfiles("test")
|
||||
class VibingBackendApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
// This test verifies that the Spring application context loads successfully
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:postgresql://localhost:5432/your_test_database
|
||||
username: test_user
|
||||
password: test_password
|
||||
url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=PostgreSQL
|
||||
username: sa
|
||||
password:
|
||||
driver-class-name: org.h2.Driver
|
||||
|
||||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: none # Let Flyway handle schema creation
|
||||
show-sql: true
|
||||
database-platform: org.hibernate.dialect.H2Dialect
|
||||
|
||||
flyway:
|
||||
enabled: true
|
||||
clean-disabled: false # Allow clean in tests
|
||||
locations: classpath:db/migration
|
||||
locations: classpath:db/migration
|
||||
|
||||
Reference in New Issue
Block a user