Skip to content

Commit

Permalink
added a liquibase file for creating payments table and fixed some che…
Browse files Browse the repository at this point in the history
…ckstyle issues
  • Loading branch information
ivan0dyatlyukkk committed Oct 2, 2023
1 parent 452252e commit 0a2bb33
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 9 deletions.
13 changes: 11 additions & 2 deletions src/main/java/com/project/carsharingapp/model/Payment.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package com.project.carsharingapp.model;

import jakarta.persistence.*;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import lombok.Getter;
import lombok.Setter;
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/com/project/carsharingapp/model/Rental.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package com.project.carsharingapp.model;

import jakarta.persistence.*;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#spring.datasource.url=jdbc:mysql://localhost:3306/car_sharing_db?serverTimezone=UTC
#spring.datasource.username=root
#spring.datasource.password=anton7570857
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/car_sharing_db?serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=redblack0root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

server.servlet.context-path=/api
spring.jpa.hibernate.ddl-auto=validate
Expand Down
47 changes: 47 additions & 0 deletions src/main/resources/db/changelog/changes/create-payments-table.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
databaseChangeLog:
- changeSet:
id: create-payments-table
author: ivan-diatliuk
changes:
- createTable:
tableName: payments
columns:
- column:
name: id
type: bigint
autoIncrement: true
constraints:
nullable: false
primaryKey: true
- column:
name: status
type: varchar(255)
constraints:
nullable: false
- column:
name: type
type: varchar(255)
constraints:
nullable: false
- column:
name: rental_id
type: bigint
constraints:
nullable: false
foreignKeyName: fk_rental_id
references: rentals(id)
- column:
name: session_url
type: varchar(255)
constraints:
nullable: false
- column:
name: session_id
type: varchar(255)
constraints:
nullable: false
- column:
name: amount
type: decimal
constraints:
nullable: false
3 changes: 2 additions & 1 deletion src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ databaseChangeLog:
file: db/changelog/changes/create-user-roles-table.yaml
- include:
file: db/changelog/changes/create-rentals-table.yaml

- include:
file: db/changelog/changes/create-payments-table.yaml

0 comments on commit 0a2bb33

Please sign in to comment.