-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spring upgrade, property cleanup & Flyway reset (#510)
* Upgrade Spring and move to pure flyway migration strategy * Enable Flyway clean() for dev profile and clean up properties with default values * Fix missing mail property in production profile * Change some columns to TEXT type * Update postgres Docker readme for easier default setup * Remove leftover clearAll method
- Loading branch information
1 parent
d54ba89
commit eb9840b
Showing
14 changed files
with
131 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
|
||
@Entity | ||
@Getter | ||
@Table(name = "orders") | ||
public class Order { | ||
|
||
@Id | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/ch/wisv/areafiftylan/utils/TestDataCleaner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ch.wisv.areafiftylan.utils; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.flywaydb.core.Flyway; | ||
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Slf4j | ||
@Profile("dev") | ||
public class TestDataCleaner implements FlywayMigrationStrategy { | ||
|
||
@Override | ||
public void migrate(Flyway flyway) { | ||
log.debug("Cleaning data"); | ||
flyway.clean(); | ||
log.debug("Initalizing migrations"); | ||
flyway.migrate(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
...java/ch/wisv/areafiftylan/utils/db/migration/V20171201140920__add_subscription_table.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...java/ch/wisv/areafiftylan/utils/db/migration/V20171201153120__rename_taken_to_locked.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
src/main/java/ch/wisv/areafiftylan/utils/db/migration/V20171208163050__add_banner.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
spring: | ||
flyway: | ||
enabled: false | ||
jpa: | ||
properties: | ||
javax: | ||
persistence: | ||
schema-generation: | ||
create-source: metadata | ||
scripts: | ||
action: create | ||
create-target: src/main/resources/ddl_jpa_creation.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
spring.jpa.hibernate.ddl-auto: validate | ||
spring.jpa.properties.hibernate.hbm2ddl.auto: none | ||
|
||
logging: | ||
file: /tmp/logs/lancie-api.log | ||
file: | ||
name: /tmp/logs/lancie-api.log | ||
|
||
## AREA FIFTYLAN SETTINGS | ||
a5l: | ||
|
@@ -15,6 +13,7 @@ a5l: | |
sender: LANcie <[email protected]> | ||
contact: LANcie <[email protected]> | ||
confirmUrl: https://areafiftylan.nl/register-confirm | ||
year: 2020 | ||
ratelimit: | ||
enabled: true | ||
minute: 10 | ||
|
@@ -23,7 +22,3 @@ a5l: | |
ticketLimit: 220 | ||
orderKeepAlive: 15 | ||
year: 2019 | ||
spring: | ||
flyway: | ||
enabled: true | ||
locations: ch/wisv/areafiftylan/utils/db/migration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
create sequence hibernate_sequence start 1 increment 1; | ||
create table authentication_token (id int8 not null, primary key (id)); | ||
create table banner (id int8 not null, end_date date, start_date date, text text, primary key (id)); | ||
create table committee_member (position int8 not null, function varchar(255), icon varchar(255), name varchar(255), primary key (position)); | ||
create table consumption (id int8 not null, name varchar(255), primary key (id)); | ||
create table consumption_map (id int8 not null, ticket_id int8, primary key (id)); | ||
create table consumption_map_consumptions_made (consumption_map_id int8 not null, consumptions_made_id int8 not null); | ||
create table expired_order (id int8 not null, created_at varchar(255), created_by varchar(255), expired_at varchar(255), number_of_tickets int4 not null, primary key (id)); | ||
create table faq_pair (id int8 not null, answer text, question varchar(255), primary key (id)); | ||
create table orders (id int8 not null, creation_date_time timestamp, reference varchar(255), status int4, user_id int8, primary key (id)); | ||
create table orders_tickets (order_id int8 not null, tickets_id int8 not null, primary key (order_id, tickets_id)); | ||
create table password_reset_token (id int8 not null, primary key (id)); | ||
create table profile (id int8 not null, address varchar(255), birthday date, city varchar(255), display_name varchar(255), first_name varchar(255), gender int4, last_name varchar(255), notes varchar(255), phone_number varchar(255), zipcode varchar(255), primary key (id)); | ||
create table rfidlink (id int8 not null, rfid varchar(255), ticket_id int8, primary key (id)); | ||
create table seat (id int8 not null, locked boolean not null, seat_group varchar(255), seat_number int4 not null, ticket_id int8, primary key (id)); | ||
create table sponsor (id int8 not null, image_name varchar(255), name varchar(255), type int4, website varchar(255), primary key (id)); | ||
create table subscription (id int8 not null, email varchar(255), primary key (id)); | ||
create table team (id int8 not null, size int4 not null, team_name varchar(255) not null, captain_id int8 not null, primary key (id)); | ||
create table team_members (team_id int8 not null, members_id int8 not null, primary key (team_id, members_id)); | ||
create table team_invite_token (id int8 not null, team_id int8 not null, primary key (id)); | ||
create table ticket (id int8 not null, valid boolean not null, owner_id int8, type_id int8, primary key (id)); | ||
create table ticket_enabled_options (ticket_id int8 not null, enabled_options_id int8 not null, primary key (ticket_id, enabled_options_id)); | ||
create table ticket_option (id int8 not null, name varchar(255), price float4 not null, primary key (id)); | ||
create table ticket_transfer_token (id int8 not null, ticket_id int8 not null, primary key (id)); | ||
create table ticket_type (id int8 not null, buyable boolean not null, deadline timestamp, name varchar(255), number_available int4 not null, price float4 not null, text varchar(255), primary key (id)); | ||
create table ticket_type_possible_options (ticket_type_id int8 not null, possible_options_id int8 not null, primary key (ticket_type_id, possible_options_id)); | ||
create table token (id int8 not null, expirable BOOLEAN DEFAULT TRUE not null, expiry_date timestamp, revoked BOOLEAN DEFAULT FALSE not null, token varchar(255), used BOOLEAN DEFAULT FALSE not null, user_id int8 not null, primary key (id)); | ||
create table tournament (id int8 not null, button_image_path varchar(255), button_title varchar(255), description text, format varchar(255), header_title varchar(255), type int4, sponsor_id int8, primary key (id)); | ||
create table tournament_prize (tournament_id int8 not null, prizes varchar(255)); | ||
create table user_role (user_id int8 not null, roles varchar(255)); | ||
create table users (id int8 not null, account_non_expired boolean not null, account_non_locked boolean not null, credentials_non_expired boolean not null, email varchar(255) not null, enabled boolean not null, password_hash varchar(255) not null, profile_id int8, primary key (id)); | ||
create table verification_token (id int8 not null, primary key (id)); | ||
alter table if exists orders_tickets add constraint UK_lxwrvh4y2ons9ohgu50msfbly unique (tickets_id); | ||
alter table if exists seat add constraint seatConstraint unique (seat_group, seat_number); | ||
alter table if exists subscription add constraint UK_r9kv3a5fkv7vnvu8bbpulavmk unique (email); | ||
alter table if exists team add constraint teamName unique (team_name); | ||
alter table if exists users add constraint email unique (email); | ||
alter table if exists authentication_token add constraint FKdbv62go71ree32qv0bm6gqam2 foreign key (id) references token; | ||
alter table if exists consumption_map add constraint FKsrrxfhrofqjjcsb860h16dpop foreign key (ticket_id) references ticket; | ||
alter table if exists consumption_map_consumptions_made add constraint FKag9n6oxcuocwnc1yc9tr1w3cw foreign key (consumptions_made_id) references consumption; | ||
alter table if exists consumption_map_consumptions_made add constraint FKqrs02quftjk84a7uojo36wokd foreign key (consumption_map_id) references consumption_map; | ||
alter table if exists orders add constraint FK32ql8ubntj5uh44ph9659tiih foreign key (user_id) references users; | ||
alter table if exists orders_tickets add constraint FK4fqm8urjjqfiwct4oj14xkfrl foreign key (tickets_id) references ticket; | ||
alter table if exists orders_tickets add constraint FKjoggp5iyq5fqbtxi5r1m2wlty foreign key (order_id) references orders; | ||
alter table if exists password_reset_token add constraint FKri9g6njpisvtpqe430bynv4lq foreign key (id) references token; | ||
alter table if exists rfidlink add constraint FK2f30uyki11lmtg56q0cbqw6pk foreign key (ticket_id) references ticket; | ||
alter table if exists seat add constraint FK8ngrgsadp7q1lcakg3kkdmvqj foreign key (ticket_id) references ticket; | ||
alter table if exists team add constraint FKb1pjk4pg0yi1qvw0i7pvfy3us foreign key (captain_id) references users; | ||
alter table if exists team_members add constraint FK4rl09ugxbntgyfhogal3s67ji foreign key (members_id) references users; | ||
alter table if exists team_members add constraint FKb3toat7ors5scfmd3n69dhmr1 foreign key (team_id) references team; | ||
alter table if exists team_invite_token add constraint FKa5gxt5guatw99qkswjf6pkbl3 foreign key (team_id) references team; | ||
alter table if exists team_invite_token add constraint FK3597euynm1cuvaltyyprwjm4e foreign key (id) references token; | ||
alter table if exists ticket add constraint FKjgquudbb9q93fl5odb28lmscj foreign key (owner_id) references users; | ||
alter table if exists ticket add constraint FKnk40xmmqnx78naomux703i9vs foreign key (type_id) references ticket_type; | ||
alter table if exists ticket_enabled_options add constraint FKmyjy3uibhokscu0a12b0kciwr foreign key (enabled_options_id) references ticket_option; | ||
alter table if exists ticket_enabled_options add constraint FKdi94eaxwrpnpightqkyg3okse foreign key (ticket_id) references ticket; | ||
alter table if exists ticket_transfer_token add constraint FKf2oeyewgv1csjxaag5c0weoa1 foreign key (ticket_id) references ticket; | ||
alter table if exists ticket_transfer_token add constraint FK6b9awma746y1u2kc25hifqs0s foreign key (id) references token; | ||
alter table if exists ticket_type_possible_options add constraint FKc0rw0dtfj7duebxsni3l6u084 foreign key (possible_options_id) references ticket_option; | ||
alter table if exists ticket_type_possible_options add constraint FKgihp1b7p36hygc2ar4ilodgef foreign key (ticket_type_id) references ticket_type; | ||
alter table if exists token add constraint FKj8rfw4x0wjjyibfqq566j4qng foreign key (user_id) references users; | ||
alter table if exists tournament add constraint FK3yc1a3c3e0cvydcrgl4ih0rne foreign key (sponsor_id) references sponsor; | ||
alter table if exists tournament_prize add constraint FKex38yydummrcremcnmlff60su foreign key (tournament_id) references tournament; | ||
alter table if exists user_role add constraint FKj345gk1bovqvfame88rcx7yyx foreign key (user_id) references users; | ||
alter table if exists users add constraint FK5q3e9303ap1wvtia6sft7ht1s foreign key (profile_id) references profile; | ||
alter table if exists verification_token add constraint FK92nvkrl137qsd36ryx66f1mfe foreign key (id) references token; |