-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rivo pelu
committed
Dec 10, 2024
1 parent
8459a9b
commit 6499f71
Showing
5 changed files
with
172 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.pos.app.entities; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@Entity | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Table(name = "customer_table") | ||
public class CustomerTable extends BaseEntity { | ||
|
||
@Column(name = "table_number") | ||
private Integer tableNumber; | ||
|
||
@Column(name = "customer_name") | ||
private String customerName; | ||
|
||
@JoinColumn(name = "merchant_id") | ||
@ManyToOne | ||
private Merchant merchant; | ||
|
||
@JoinColumn(name = "client_id") | ||
@ManyToOne | ||
private Client client; | ||
|
||
} |
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,29 @@ | ||
package com.pos.app.entities; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@Entity | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Table(name = "merchant") | ||
public class Merchant extends BaseEntity { | ||
|
||
@Column(name = "name") | ||
private String name; | ||
@Column(name = "address") | ||
private String address; | ||
@Column(name = "note") | ||
private String note; | ||
|
||
@JoinColumn(name = "client_id") | ||
@ManyToOne | ||
private Client client; | ||
|
||
|
||
|
||
|
||
} |
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
108 changes: 108 additions & 0 deletions
108
src/main/resources/db/changelog/1.7.0_add_table_merchant_and_customer_table.xml
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,108 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog | ||
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
|
||
<changeSet id="1.7.0" author="rivo pelu"> | ||
<createTable tableName="merchant"> | ||
<!-- BASE ENTITY START--> | ||
<column name="id" type="varchar(255)"> | ||
<constraints nullable="false" primaryKey="true" unique="true"/> | ||
</column> | ||
<column name="active" type="int(1)" defaultValue="1"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="created_by" type="varchar(255)" defaultValue="SYSTEM"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="created_date" type="long"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="deleted_by" type="varchar(255)"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="deleted_date" type="long"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="updated_by" type="varchar(255)"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="updated_date" type="long"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<!-- BASE ENTITY END--> | ||
<column name="name" type="varchar(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="address" type="text"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="note" type="text"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="client_id" type="varchar(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
|
||
</createTable> | ||
|
||
<!-- CUSTOMER TABLE--> | ||
<createTable tableName="customer_table"> | ||
<!-- BASE ENTITY START--> | ||
<column name="id" type="varchar(255)"> | ||
<constraints nullable="false" primaryKey="true" unique="true"/> | ||
</column> | ||
<column name="active" type="int(1)" defaultValue="1"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="created_by" type="varchar(255)" defaultValue="SYSTEM"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="created_date" type="long"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="deleted_by" type="varchar(255)"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="deleted_date" type="long"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="updated_by" type="varchar(255)"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="updated_date" type="long"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<!-- BASE ENTITY END--> | ||
<column name="table_number" type="int"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="customer_name" type="varchar(255)"> | ||
<constraints nullable="true"/> | ||
</column> | ||
<column name="merchant_id" type="varchar(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
|
||
<column name="client_id" type="varchar(255)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
</createTable> | ||
<addForeignKeyConstraint baseTableName="customer_table" | ||
baseColumnNames="client_id" | ||
constraintName="client_customer_table_fk" | ||
referencedTableName="client" | ||
referencedColumnNames="id"/> | ||
<addForeignKeyConstraint baseTableName="customer_table" | ||
baseColumnNames="merchant_id" | ||
constraintName="merchant_customer_table_fk" | ||
referencedTableName="merchant" | ||
referencedColumnNames="id"/> | ||
<addForeignKeyConstraint baseTableName="merchant" | ||
baseColumnNames="client_id" | ||
constraintName="merchant_client_fk" | ||
referencedTableName="client" | ||
referencedColumnNames="id"/> | ||
</changeSet> | ||
</databaseChangeLog> |
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