feat!: Added database migration support
This commit is contained in:
parent
f0fcbb588d
commit
7cd3b063bc
@ -10,3 +10,8 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
||||
# H2 console
|
||||
spring.h2.console.enabled=true
|
||||
spring.h2.console.path=/h2-console
|
||||
|
||||
# Flyway
|
||||
spring.flyway.enabled=true
|
||||
spring.flyway.locations=filesystem:infrastructure/out/sql-repository/sql/migration
|
||||
spring.flyway.baseline-on-migrate=true
|
||||
@ -26,6 +26,15 @@
|
||||
<artifactId>application</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-maven-plugin</artifactId>
|
||||
<version>11.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,11 @@
|
||||
CREATE TABLE prices (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
brand_id BIGINT NOT NULL,
|
||||
start_date TIMESTAMP NOT NULL,
|
||||
end_date TIMESTAMP NOT NULL,
|
||||
price_list BIGINT NOT NULL,
|
||||
product_id BIGINT NOT NULL,
|
||||
priority BIGINT NOT NULL,
|
||||
price DECIMAL(10, 2) NOT NULL,
|
||||
currency VARCHAR(3)
|
||||
);
|
||||
@ -0,0 +1,6 @@
|
||||
INSERT INTO prices (brand_id, start_date, end_date, price_list, product_id, priority, price, currency)
|
||||
VALUES
|
||||
(1, '2020-06-14 00:00:00', '2020-12-31 23:59:59', 1, 35455, 0, 35.50, 'EUR'),
|
||||
(1, '2020-06-14 15:00:00', '2020-06-14 18:30:00', 2, 35455, 1, 25.45, 'EUR'),
|
||||
(1, '2020-06-15 00:00:00', '2020-06-15 11:00:00', 3, 35455, 1, 30.50, 'EUR'),
|
||||
(1, '2020-06-15 16:00:00', '2020-12-31 23:59:59', 4, 35455, 1, 38.95, 'EUR');
|
||||
4
pom.xml
4
pom.xml
@ -42,10 +42,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user