Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .http-requests/auth/app-user.http
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Content-Type: application/json
{
"firstName": "asd",
"lastName": "asd",
"username": "test12",
"password": "test12",
"username": "test",
"password": "test",
"email": "test@example.com"
}

Expand Down
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@
<version>2.3.0</version>
</dependency>

<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>10.10.0</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
<version>10.10.0</version>
</dependency>

</dependencies>

<build>
Expand Down
9 changes: 7 additions & 2 deletions src/main/resources/application-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ server:
enabled: false # disable the Whitelabel page
include-message: always # always include the HTTP message

spring:
flyway:
enabled: true
locations: classpath:db/migration
baseline-on-migrate: true

jpa:
hibernate:
ddl-auto: update
ddl-auto: validate


logging:
level:
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ spring:
url: ${DB_URL}
username: ${DB_USER}
password: ${DB_PASSWORD}
driver-class-name: org.postgresql.Driver
jwt:
jwtSecret: ${JWT_SECRET}
jwtExpiration: ${JWT_EXPIRATION}
Expand Down
19 changes: 19 additions & 0 deletions src/main/resources/db/migration/V1__create-tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE public.app_user (

Check failure on line 1 in src/main/resources/db/migration/V1__create-tables.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V1__create-tables.sql#L1

Expected SET ANSI_NULLS ON near top of file

Check failure on line 1 in src/main/resources/db/migration/V1__create-tables.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V1__create-tables.sql#L1

Expected SET NOCOUNT ON near top of file

Check failure on line 1 in src/main/resources/db/migration/V1__create-tables.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V1__create-tables.sql#L1

Expected SET QUOTED_IDENTIFIER ON near top of file

Check failure on line 1 in src/main/resources/db/migration/V1__create-tables.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V1__create-tables.sql#L1

Expected SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED near top of file

Check warning on line 1 in src/main/resources/db/migration/V1__create-tables.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V1__create-tables.sql#L1

Expected TSQL Keyword to be capitalized
id SERIAL PRIMARY KEY,
first_name VARCHAR(255),
last_name VARCHAR(255),
username VARCHAR(255),
password VARCHAR(255),
email VARCHAR(255),
image_url VARCHAR(255),
create_date TIMESTAMP,
modify_date TIMESTAMP
);

CREATE TABLE public.app_user_user_role (

Check warning on line 13 in src/main/resources/db/migration/V1__create-tables.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V1__create-tables.sql#L13

Expected TSQL Keyword to be capitalized
app_user_id INT NOT NULL,
user_role VARCHAR(50) NOT NULL,
CONSTRAINT fk_app_user FOREIGN KEY (app_user_id)
REFERENCES public.app_user(id)

Check warning on line 17 in src/main/resources/db/migration/V1__create-tables.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V1__create-tables.sql#L17

Expected TSQL Keyword to be capitalized
ON DELETE CASCADE
);
25 changes: 25 additions & 0 deletions src/main/resources/db/migration/V2__insert-app-user.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
INSERT INTO public.app_user (

Check failure on line 1 in src/main/resources/db/migration/V2__insert-app-user.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V2__insert-app-user.sql#L1

Expected SET ANSI_NULLS ON near top of file

Check failure on line 1 in src/main/resources/db/migration/V2__insert-app-user.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V2__insert-app-user.sql#L1

Expected SET NOCOUNT ON near top of file

Check failure on line 1 in src/main/resources/db/migration/V2__insert-app-user.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V2__insert-app-user.sql#L1

Expected SET QUOTED_IDENTIFIER ON near top of file

Check failure on line 1 in src/main/resources/db/migration/V2__insert-app-user.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V2__insert-app-user.sql#L1

Expected SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED near top of file

Check warning on line 1 in src/main/resources/db/migration/V2__insert-app-user.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V2__insert-app-user.sql#L1

Expected TSQL Keyword to be capitalized
first_name,
last_name,
username,
password,
email,
image_url,
create_date,
modify_date
) VALUES (
'Benyamin',
'Smith',
'test10',
'$2b$12$ytf8RUEeUB4imdjah/.KBuBQpPGN/9M7bMtToTP5jf1X3pRMj8kUi',
'venya@example.com',
'https://example.com/images/ivan.jpg',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
);

INSERT INTO public.app_user_user_role (app_user_id, user_role) VALUES (

Check warning on line 21 in src/main/resources/db/migration/V2__insert-app-user.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V2__insert-app-user.sql#L21

Expected TSQL Keyword to be capitalized

(SELECT id FROM public.app_user WHERE username = 'test10'),

Check warning on line 23 in src/main/resources/db/migration/V2__insert-app-user.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/resources/db/migration/V2__insert-app-user.sql#L23

Expected TSQL Keyword to be capitalized
'ADMIN'
);