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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Index;
import java.time.LocalDateTime;
import lombok.AccessLevel;
import lombok.Builder;
Expand All @@ -24,9 +25,7 @@
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(indexes = {
@Index(name = "idx_account_user_id", columnList = "user_id"),
@Index(name = "idx_account_is_deleted", columnList = "is_deleted"),
@Index(name = "idx_account_user_deleted", columnList = "user_id, is_deleted")
@Index(name = "ix_account_user_is_deleted", columnList = "user_id, is_deleted")
})
public class Account extends AuditTime {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Index;
import jakarta.persistence.UniqueConstraint;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -31,11 +33,10 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "balance", indexes = {
@Index(name = "idx_balance_account_id", columnList = "account_id"),
@Index(name = "idx_balance_coin_type", columnList = "coin_type"),
@Index(name = "idx_balance_account_coin", columnList = "account_id, coin_type")
})
@Table(
uniqueConstraints = {
@UniqueConstraint(name = "uk_balance_account_coin_type", columnNames = {"account_id", "coin_type"})
})
public class Balance extends AuditTime {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Index;
import jakarta.persistence.Index;
import java.math.BigDecimal;
import java.math.RoundingMode;
import lombok.AccessLevel;
Expand All @@ -35,11 +36,7 @@
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(indexes = {
@Index(name = "idx_futures_order_account_id", columnList = "account_id"),
@Index(name = "idx_futures_order_strategy_id", columnList = "strategy_id"),
@Index(name = "idx_futures_order_status", columnList = "order_status"),
@Index(name = "idx_futures_order_created_at", columnList = "created_at"),
@Index(name = "idx_futures_order_account_strategy", columnList = "account_id, strategy_id")
@Index(name = "ix_futures_order_account_strategy", columnList = "account_id, strategy_id")
})
public class FuturesOrder extends AuditTime {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Index;
import jakarta.persistence.UniqueConstraint;
import java.math.BigDecimal;
import java.math.RoundingMode;
Expand All @@ -37,10 +38,11 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(
uniqueConstraints = @UniqueConstraint(columnNames = {"account_id", "coinType"}),
uniqueConstraints = {
@UniqueConstraint(name = "uk_futures_position_account_coin_type", columnNames = {"account_id", "coin_type"})
},
indexes = {
@Index(name = "idx_futures_position_account_coin", columnList = "account_id, coinType"),
@Index(name = "idx_futures_position_created_at", columnList = "created_at")
@Index(name = "ix_futures_position_coin_type_liquidation_price", columnList = "coin_type, liquidation_price")
}
)
public class FuturesPosition extends AuditTime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Index;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(indexes = {
@Index(name = "idx_history_strategy_id", columnList = "strategy_id"),
@Index(name = "idx_history_created_at", columnList = "created_at"),
@Index(name = "idx_history_strategy_created", columnList = "strategy_id, created_at")
@Index(name = "idx_history_strategy_exit", columnList = "strategy_id, exit_time DESC")
})
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class History extends AuditTime {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Index;
import jakarta.persistence.Index;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -20,13 +21,9 @@
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "outbox_message", indexes = {
@Index(name = "idx_outbox_message_type", columnList = "message_type"),
@Index(name = "idx_outbox_message_id", columnList = "message_id"),
@Index(name = "idx_outbox_status", columnList = "status"),
@Index(name = "idx_outbox_type_status", columnList = "message_type, status"),
@Index(name = "idx_outbox_created_at", columnList = "created_at"),
@Index(name = "idx_outbox_updated_at", columnList = "updated_at")
@Table(indexes = {
@Index(name = "idx_outbox_message_type_status", columnList = "message_type, status"),
@Index(name = "idx_outbox_message_id", columnList = "message_id")
})
public class OutboxMessage extends AuditTime {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
@Getter
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(indexes = {
@Index(name = "idx_strategy_name", columnList = "name"),
@Index(name = "idx_strategy_type_strategy", columnList = "strategy_type"),
@Index(name = "idx_strategy_type_coin", columnList = "coin_type"),
@Index(name = "idx_strategy_type_timeframe", columnList = "time_frame_type"),
@Index(name = "idx_strategy_profit_factor", columnList = "profit_factor"),
@Index(name = "idx_strategy_created_at", columnList = "created_at")
})
public class Strategy extends AuditTime {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Index;
import jakarta.persistence.UniqueConstraint;
import java.time.LocalDateTime;
import lombok.AccessLevel;
Expand All @@ -27,14 +28,11 @@
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(
uniqueConstraints = @UniqueConstraint(columnNames = {"account_id", "strategy_id"}),
uniqueConstraints = {
@UniqueConstraint(name = "uk_subscription_strategy_account", columnNames = {"strategy_id", "account_id"})
},
indexes = {
@Index(name = "idx_subscription_account_id", columnList = "account_id"),
@Index(name = "idx_subscription_strategy_id", columnList = "strategy_id"),
@Index(name = "idx_subscription_status", columnList = "status"),
@Index(name = "idx_subscription_strategy_status", columnList = "strategy_id, status"),
@Index(name = "idx_subscription_start_date", columnList = "start_date"),
@Index(name = "idx_subscription_end_date", columnList = "end_date")
@Index(name = "ix_subscription_strategy_status_account", columnList = "strategy_id, status, account_id")
}
)
public class Subscription extends AuditTime {
Expand All @@ -43,14 +41,14 @@ public class Subscription extends AuditTime {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne
@JoinColumn(name = "account_id", nullable = false)
private Account account;

@ManyToOne
@JoinColumn(name = "strategy_id", nullable = false)
private Strategy strategy;

@ManyToOne
@JoinColumn(name = "account_id", nullable = false)
private Account account;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private SubscriptionStatus status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(indexes = {
@Index(name = "idx_users_email", columnList = "email"),
@Index(name = "idx_users_sub", columnList = "sub")
@Index(name = "ix_users_email", columnList = "email"),
@Index(name = "ix_users_sub", columnList = "sub")
})
public class Users extends AuditTime implements UserDetails {

Expand Down
Loading