consolidate migrations
This commit is contained in:
@@ -9,5 +9,6 @@ RUN mvn -q -DskipTests package
|
|||||||
FROM eclipse-temurin:25-jre
|
FROM eclipse-temurin:25-jre
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /app/target/*.jar app.jar
|
COPY --from=build /app/target/*.jar app.jar
|
||||||
|
COPY uploads ./uploads
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
ENTRYPOINT ["java","-jar","app.jar"]
|
ENTRYPOINT ["java","-jar","app.jar"]
|
||||||
|
|||||||
@@ -75,14 +75,6 @@ public class CartController {
|
|||||||
return ResponseEntity.ok(cartService.applyCoupon(userId, storeId, request.getCouponCode()));
|
return ResponseEntity.ok(cartService.applyCoupon(userId, storeId, request.getCouponCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/apply-points")
|
|
||||||
@PreAuthorize("isAuthenticated()")
|
|
||||||
public ResponseEntity<CartResponse> applyPoints(@Valid @RequestBody ApplyPointsRequest request) {
|
|
||||||
Long userId = AuthenticationHelper.getAuthenticatedUserId();
|
|
||||||
|
|
||||||
return ResponseEntity.ok(cartService.applyPoints(userId, request.getStoreId(), request.getUseLoyaltyPoints()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/checkout")
|
@PostMapping("/checkout")
|
||||||
@PreAuthorize("isAuthenticated()")
|
@PreAuthorize("isAuthenticated()")
|
||||||
public ResponseEntity<CheckoutResponse> checkout(@Valid @RequestBody CheckoutRequest request) {
|
public ResponseEntity<CheckoutResponse> checkout(@Valid @RequestBody CheckoutRequest request) {
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package com.petshop.backend.dto.cart;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
public class ApplyPointsRequest {
|
|
||||||
|
|
||||||
@NotNull(message = "Store ID is required")
|
|
||||||
private Long storeId;
|
|
||||||
|
|
||||||
@NotNull(message = "useLoyaltyPoints is required")
|
|
||||||
private Boolean useLoyaltyPoints;
|
|
||||||
|
|
||||||
public Long getStoreId() {
|
|
||||||
return storeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStoreId(Long storeId) {
|
|
||||||
this.storeId = storeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getUseLoyaltyPoints() {
|
|
||||||
return useLoyaltyPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUseLoyaltyPoints(Boolean useLoyaltyPoints) {
|
|
||||||
this.useLoyaltyPoints = useLoyaltyPoints;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import jakarta.validation.constraints.NotEmpty;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
public class SaleRequest {
|
public class SaleRequest {
|
||||||
@NotNull(message = "Store ID is required")
|
@NotNull(message = "Store ID is required")
|
||||||
@@ -29,9 +28,6 @@ public class SaleRequest {
|
|||||||
|
|
||||||
private Long cartId;
|
private Long cartId;
|
||||||
|
|
||||||
private Integer pointsUsed;
|
|
||||||
|
|
||||||
private BigDecimal pointsDiscountAmount;
|
|
||||||
|
|
||||||
public Long getStoreId() {
|
public Long getStoreId() {
|
||||||
return storeId;
|
return storeId;
|
||||||
@@ -105,21 +101,6 @@ public class SaleRequest {
|
|||||||
this.cartId = cartId;
|
this.cartId = cartId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPointsUsed() {
|
|
||||||
return pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsUsed(Integer pointsUsed) {
|
|
||||||
this.pointsUsed = pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPointsDiscountAmount() {
|
|
||||||
return pointsDiscountAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsDiscountAmount(BigDecimal pointsDiscountAmount) {
|
|
||||||
this.pointsDiscountAmount = pointsDiscountAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
@@ -134,13 +115,12 @@ public class SaleRequest {
|
|||||||
Objects.equals(customerId, that.customerId) &&
|
Objects.equals(customerId, that.customerId) &&
|
||||||
Objects.equals(channel, that.channel) &&
|
Objects.equals(channel, that.channel) &&
|
||||||
Objects.equals(couponId, that.couponId) &&
|
Objects.equals(couponId, that.couponId) &&
|
||||||
Objects.equals(cartId, that.cartId) &&
|
Objects.equals(cartId, that.cartId);
|
||||||
Objects.equals(useLoyaltyPoints, that.useLoyaltyPoints);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(storeId, paymentMethod, items, isRefund, originalSaleId, customerId, channel, couponId, cartId, useLoyaltyPoints);
|
return Objects.hash(storeId, paymentMethod, items, isRefund, originalSaleId, customerId, channel, couponId, cartId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -155,7 +135,6 @@ public class SaleRequest {
|
|||||||
", channel='" + channel + '\'' +
|
", channel='" + channel + '\'' +
|
||||||
", couponId=" + couponId +
|
", couponId=" + couponId +
|
||||||
", cartId=" + cartId +
|
", cartId=" + cartId +
|
||||||
", useLoyaltyPoints=" + useLoyaltyPoints +
|
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ public class SaleResponse {
|
|||||||
private BigDecimal couponDiscountAmount;
|
private BigDecimal couponDiscountAmount;
|
||||||
private BigDecimal employeeDiscountAmount;
|
private BigDecimal employeeDiscountAmount;
|
||||||
private BigDecimal loyaltyDiscountAmount;
|
private BigDecimal loyaltyDiscountAmount;
|
||||||
private Integer pointsUsed;
|
|
||||||
private Integer pointsEarned;
|
private Integer pointsEarned;
|
||||||
private Integer pointsUsed;
|
|
||||||
private BigDecimal pointsDiscountAmount;
|
|
||||||
private String channel;
|
private String channel;
|
||||||
private Long couponId;
|
private Long couponId;
|
||||||
private Long cartId;
|
private Long cartId;
|
||||||
@@ -139,13 +136,6 @@ public class SaleResponse {
|
|||||||
this.loyaltyDiscountAmount = loyaltyDiscountAmount;
|
this.loyaltyDiscountAmount = loyaltyDiscountAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPointsUsed() {
|
|
||||||
return pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsUsed(Integer pointsUsed) {
|
|
||||||
this.pointsUsed = pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPointsEarned() {
|
public Integer getPointsEarned() {
|
||||||
return pointsEarned;
|
return pointsEarned;
|
||||||
@@ -155,22 +145,6 @@ public class SaleResponse {
|
|||||||
this.pointsEarned = pointsEarned;
|
this.pointsEarned = pointsEarned;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPointsUsed() {
|
|
||||||
return pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsUsed(Integer pointsUsed) {
|
|
||||||
this.pointsUsed = pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPointsDiscountAmount() {
|
|
||||||
return pointsDiscountAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsDiscountAmount(BigDecimal pointsDiscountAmount) {
|
|
||||||
this.pointsDiscountAmount = pointsDiscountAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChannel() {
|
public String getChannel() {
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,8 +66,6 @@ public class Sale {
|
|||||||
@Column(nullable = false, precision = 10, scale = 2)
|
@Column(nullable = false, precision = 10, scale = 2)
|
||||||
private BigDecimal employeeDiscountAmount = BigDecimal.ZERO;
|
private BigDecimal employeeDiscountAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
private Integer pointsUsed = 0;
|
|
||||||
|
|
||||||
@Column(nullable = false, precision = 10, scale = 2)
|
@Column(nullable = false, precision = 10, scale = 2)
|
||||||
private BigDecimal loyaltyDiscountAmount = BigDecimal.ZERO;
|
private BigDecimal loyaltyDiscountAmount = BigDecimal.ZERO;
|
||||||
@@ -75,12 +73,6 @@ public class Sale {
|
|||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Integer pointsEarned = 0;
|
private Integer pointsEarned = 0;
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
private Integer pointsUsed = 0;
|
|
||||||
|
|
||||||
@Column(nullable = false, precision = 10, scale = 2)
|
|
||||||
private BigDecimal pointsDiscountAmount = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "sale", cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = "sale", cascade = CascadeType.ALL)
|
||||||
private List<SaleItem> items = new ArrayList<>();
|
private List<SaleItem> items = new ArrayList<>();
|
||||||
|
|
||||||
@@ -215,13 +207,6 @@ public class Sale {
|
|||||||
this.employeeDiscountAmount = employeeDiscountAmount;
|
this.employeeDiscountAmount = employeeDiscountAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPointsUsed() {
|
|
||||||
return pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsUsed(Integer pointsUsed) {
|
|
||||||
this.pointsUsed = pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getLoyaltyDiscountAmount() {
|
public BigDecimal getLoyaltyDiscountAmount() {
|
||||||
return loyaltyDiscountAmount;
|
return loyaltyDiscountAmount;
|
||||||
@@ -239,22 +224,6 @@ public class Sale {
|
|||||||
this.pointsEarned = pointsEarned;
|
this.pointsEarned = pointsEarned;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPointsUsed() {
|
|
||||||
return pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsUsed(Integer pointsUsed) {
|
|
||||||
this.pointsUsed = pointsUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPointsDiscountAmount() {
|
|
||||||
return pointsDiscountAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPointsDiscountAmount(BigDecimal pointsDiscountAmount) {
|
|
||||||
this.pointsDiscountAmount = pointsDiscountAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SaleItem> getItems() {
|
public List<SaleItem> getItems() {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,7 +369,6 @@ public class CartService {
|
|||||||
saleRequest.setCouponId(cart.getCoupon() != null ? cart.getCoupon().getCouponId() : null);
|
saleRequest.setCouponId(cart.getCoupon() != null ? cart.getCoupon().getCouponId() : null);
|
||||||
saleRequest.setPaymentMethod("Card");
|
saleRequest.setPaymentMethod("Card");
|
||||||
saleRequest.setChannel("WEBSITE");
|
saleRequest.setChannel("WEBSITE");
|
||||||
saleRequest.setUseLoyaltyPoints(Boolean.TRUE.equals(cart.getPointsApplied()));
|
|
||||||
saleRequest.setItems(cartItemRepository.findByCartCartId(cart.getCartId()).stream()
|
saleRequest.setItems(cartItemRepository.findByCartCartId(cart.getCartId()).stream()
|
||||||
.map(item -> {
|
.map(item -> {
|
||||||
SaleItemRequest saleItemRequest = new SaleItemRequest();
|
SaleItemRequest saleItemRequest = new SaleItemRequest();
|
||||||
|
|||||||
@@ -160,33 +160,13 @@ public class SaleService {
|
|||||||
saleItems.add(saleItem);
|
saleItems.add(saleItem);
|
||||||
subtotalAmount = subtotalAmount.add(itemTotal);
|
subtotalAmount = subtotalAmount.add(itemTotal);
|
||||||
}
|
}
|
||||||
|
subtotalAmount = subtotalAmount.negate();
|
||||||
Sale originalSale = sale.getOriginalSale();
|
sale.setSubtotalAmount(subtotalAmount);
|
||||||
BigDecimal originalSubtotal = originalSale.getSubtotalAmount() != null
|
sale.setTotalAmount(subtotalAmount);
|
||||||
? originalSale.getSubtotalAmount()
|
sale.setCouponDiscountAmount(BigDecimal.ZERO);
|
||||||
: originalSale.getItems().stream()
|
sale.setEmployeeDiscountAmount(BigDecimal.ZERO);
|
||||||
.map(i -> i.getUnitPrice().multiply(BigDecimal.valueOf(Math.abs(i.getQuantity()))))
|
sale.setLoyaltyDiscountAmount(BigDecimal.ZERO);
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
sale.setPointsEarned(0);
|
||||||
|
|
||||||
BigDecimal refundRatio = originalSubtotal.compareTo(BigDecimal.ZERO) != 0
|
|
||||||
? subtotalAmount.divide(originalSubtotal, 10, RoundingMode.HALF_UP)
|
|
||||||
: BigDecimal.ONE;
|
|
||||||
|
|
||||||
BigDecimal refundTotal = originalSale.getTotalAmount().abs()
|
|
||||||
.multiply(refundRatio).setScale(2, RoundingMode.HALF_UP);
|
|
||||||
|
|
||||||
sale.setSubtotalAmount(subtotalAmount.negate());
|
|
||||||
sale.setTotalAmount(refundTotal.negate());
|
|
||||||
|
|
||||||
User refundCustomer = customer != null ? customer : originalSale.getCustomer();
|
|
||||||
if (refundCustomer != null) {
|
|
||||||
int pointsToRestore = BigDecimal.valueOf(originalSale.getPointsUsed())
|
|
||||||
.multiply(refundRatio).setScale(0, RoundingMode.FLOOR).intValue();
|
|
||||||
int pointsToDeduct = BigDecimal.valueOf(originalSale.getPointsEarned())
|
|
||||||
.multiply(refundRatio).setScale(0, RoundingMode.FLOOR).intValue();
|
|
||||||
refundCustomer.setLoyaltyPoints(refundCustomer.getLoyaltyPoints() + pointsToRestore - pointsToDeduct);
|
|
||||||
userRepository.save(refundCustomer);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (request.getItems() == null || request.getItems().isEmpty()) {
|
if (request.getItems() == null || request.getItems().isEmpty()) {
|
||||||
throw new BusinessException("At least one item is required");
|
throw new BusinessException("At least one item is required");
|
||||||
@@ -223,29 +203,21 @@ public class SaleService {
|
|||||||
BigDecimal couponDiscount = calculateCouponDiscount(sale.getCoupon(), subtotalAmount);
|
BigDecimal couponDiscount = calculateCouponDiscount(sale.getCoupon(), subtotalAmount);
|
||||||
sale.setCouponDiscountAmount(couponDiscount);
|
sale.setCouponDiscountAmount(couponDiscount);
|
||||||
|
|
||||||
BigDecimal pointsDiscount = BigDecimal.ZERO;
|
BigDecimal employeeDiscount = calculateEmployeeDiscount(customer, subtotalAmount.subtract(couponDiscount));
|
||||||
int pointsUsed = 0;
|
|
||||||
if (customer != null && request.getPointsUsed() != null && request.getPointsUsed() > 0) {
|
|
||||||
if (customer.getLoyaltyPoints() < request.getPointsUsed()) {
|
|
||||||
throw new BusinessException("Customer does not have enough loyalty points");
|
|
||||||
}
|
|
||||||
pointsUsed = request.getPointsUsed();
|
|
||||||
pointsDiscount = calculatePointsDiscount(pointsUsed);
|
|
||||||
customer.setLoyaltyPoints(customer.getLoyaltyPoints() - pointsUsed);
|
|
||||||
}
|
|
||||||
sale.setPointsUsed(pointsUsed);
|
|
||||||
sale.setPointsDiscountAmount(pointsDiscount);
|
|
||||||
|
|
||||||
BigDecimal employeeDiscount = calculateEmployeeDiscount(customer, subtotalAmount.subtract(couponDiscount).subtract(pointsDiscount));
|
|
||||||
sale.setEmployeeDiscountAmount(employeeDiscount);
|
sale.setEmployeeDiscountAmount(employeeDiscount);
|
||||||
|
|
||||||
BigDecimal finalTotal = subtotalAmount.subtract(couponDiscount).subtract(pointsDiscount).subtract(employeeDiscount);
|
boolean useLoyaltyPoints = sale.getCart() != null && Boolean.TRUE.equals(sale.getCart().getPointsApplied());
|
||||||
|
BigDecimal loyaltyDiscount = calculateLoyaltyDiscount(customer, subtotalAmount.subtract(couponDiscount).subtract(employeeDiscount), useLoyaltyPoints);
|
||||||
|
sale.setLoyaltyDiscountAmount(loyaltyDiscount);
|
||||||
|
|
||||||
|
BigDecimal finalTotal = subtotalAmount.subtract(couponDiscount).subtract(employeeDiscount).subtract(loyaltyDiscount);
|
||||||
sale.setTotalAmount(finalTotal.max(BigDecimal.ZERO));
|
sale.setTotalAmount(finalTotal.max(BigDecimal.ZERO));
|
||||||
|
|
||||||
|
int pointsUsed = toPointsUsed(loyaltyDiscount);
|
||||||
sale.setPointsEarned(sale.getTotalAmount().setScale(0, RoundingMode.FLOOR).intValue());
|
sale.setPointsEarned(sale.getTotalAmount().setScale(0, RoundingMode.FLOOR).intValue());
|
||||||
if (customer != null) {
|
if (customer != null) {
|
||||||
int currentPoints = customer.getLoyaltyPoints() != null ? customer.getLoyaltyPoints() : 0;
|
int currentPoints = customer.getLoyaltyPoints() != null ? customer.getLoyaltyPoints() : 0;
|
||||||
int updatedPoints = currentPoints - sale.getPointsUsed() + sale.getPointsEarned();
|
int updatedPoints = currentPoints - pointsUsed + sale.getPointsEarned();
|
||||||
customer.setLoyaltyPoints(Math.max(updatedPoints, 0));
|
customer.setLoyaltyPoints(Math.max(updatedPoints, 0));
|
||||||
userRepository.save(customer);
|
userRepository.save(customer);
|
||||||
}
|
}
|
||||||
@@ -290,10 +262,6 @@ public class SaleService {
|
|||||||
return discount.min(subtotal).setScale(2, RoundingMode.HALF_UP);
|
return discount.min(subtotal).setScale(2, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal calculatePointsDiscount(int pointsUsed) {
|
|
||||||
return new BigDecimal(pointsUsed).divide(new BigDecimal("20"), 2, RoundingMode.HALF_UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal calculateEmployeeDiscount(User customer, BigDecimal remainingAmount) {
|
private BigDecimal calculateEmployeeDiscount(User customer, BigDecimal remainingAmount) {
|
||||||
if (customer == null || remainingAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
if (customer == null || remainingAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
return BigDecimal.ZERO;
|
return BigDecimal.ZERO;
|
||||||
@@ -358,10 +326,7 @@ public class SaleService {
|
|||||||
response.setCouponDiscountAmount(sale.getCouponDiscountAmount());
|
response.setCouponDiscountAmount(sale.getCouponDiscountAmount());
|
||||||
response.setEmployeeDiscountAmount(sale.getEmployeeDiscountAmount());
|
response.setEmployeeDiscountAmount(sale.getEmployeeDiscountAmount());
|
||||||
response.setLoyaltyDiscountAmount(sale.getLoyaltyDiscountAmount());
|
response.setLoyaltyDiscountAmount(sale.getLoyaltyDiscountAmount());
|
||||||
response.setPointsUsed(sale.getPointsUsed());
|
|
||||||
response.setPointsEarned(sale.getPointsEarned());
|
response.setPointsEarned(sale.getPointsEarned());
|
||||||
response.setPointsUsed(sale.getPointsUsed());
|
|
||||||
response.setPointsDiscountAmount(sale.getPointsDiscountAmount());
|
|
||||||
response.setChannel(sale.getChannel());
|
response.setChannel(sale.getChannel());
|
||||||
if (sale.getCoupon() != null) {
|
if (sale.getCoupon() != null) {
|
||||||
response.setCouponId(sale.getCoupon().getCouponId());
|
response.setCouponId(sale.getCoupon().getCouponId());
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS storeLocation (
|
CREATE TABLE IF NOT EXISTS storeLocation (
|
||||||
storeId BIGINT AUTO_INCREMENT PRIMARY KEY,
|
storeId BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||||
storeName VARCHAR(100) NOT NULL,
|
storeName VARCHAR(100) NOT NULL,
|
||||||
@@ -192,6 +191,12 @@ CREATE TABLE IF NOT EXISTS cart (
|
|||||||
subtotalAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
subtotalAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
discountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
discountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
totalAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
totalAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
|
pointsApplied BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
pointsDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
|
checkoutPending BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
checkoutAmount DECIMAL(10, 2),
|
||||||
|
checkoutStartedAt DATETIME,
|
||||||
|
checkoutPaymentIntentId VARCHAR(255),
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
CONSTRAINT fk_cart_user FOREIGN KEY (userId) REFERENCES users(id),
|
CONSTRAINT fk_cart_user FOREIGN KEY (userId) REFERENCES users(id),
|
||||||
@@ -227,9 +232,13 @@ CREATE TABLE IF NOT EXISTS sale (
|
|||||||
subtotalAmount DECIMAL(10, 2) NULL,
|
subtotalAmount DECIMAL(10, 2) NULL,
|
||||||
couponDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
couponDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
employeeDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
employeeDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
|
pointsUsed INT NOT NULL DEFAULT 0,
|
||||||
|
loyaltyDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
pointsEarned INT NOT NULL DEFAULT 0,
|
pointsEarned INT NOT NULL DEFAULT 0,
|
||||||
|
pointsDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
CONSTRAINT uq_sale_cart_id UNIQUE (cartId),
|
||||||
CONSTRAINT fk_sale_employee FOREIGN KEY (employeeId) REFERENCES users(id),
|
CONSTRAINT fk_sale_employee FOREIGN KEY (employeeId) REFERENCES users(id),
|
||||||
CONSTRAINT fk_sale_store FOREIGN KEY (storeId) REFERENCES storeLocation(storeId),
|
CONSTRAINT fk_sale_store FOREIGN KEY (storeId) REFERENCES storeLocation(storeId),
|
||||||
CONSTRAINT fk_sale_customer FOREIGN KEY (customerId) REFERENCES users(id) ON DELETE SET NULL,
|
CONSTRAINT fk_sale_customer FOREIGN KEY (customerId) REFERENCES users(id) ON DELETE SET NULL,
|
||||||
@@ -275,6 +284,20 @@ CREATE TABLE IF NOT EXISTS refund_item (
|
|||||||
CONSTRAINT fk_refund_item_product FOREIGN KEY (prod_id) REFERENCES product(prodId)
|
CONSTRAINT fk_refund_item_product FOREIGN KEY (prod_id) REFERENCES product(prodId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS passwordResetToken (
|
||||||
|
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
userId BIGINT NOT NULL,
|
||||||
|
tokenHash VARCHAR(64) NOT NULL,
|
||||||
|
expiresAt DATETIME NOT NULL,
|
||||||
|
usedAt DATETIME NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
CONSTRAINT uq_password_reset_token_hash UNIQUE (tokenHash),
|
||||||
|
CONSTRAINT fk_password_reset_token_user FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_password_reset_token_user ON passwordResetToken(userId);
|
||||||
|
CREATE INDEX idx_password_reset_token_expires ON passwordResetToken(expiresAt);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS conversation (
|
CREATE TABLE IF NOT EXISTS conversation (
|
||||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||||
customerId BIGINT NOT NULL,
|
customerId BIGINT NOT NULL,
|
||||||
@@ -307,6 +330,10 @@ CREATE TABLE IF NOT EXISTS activityLog (
|
|||||||
logId BIGINT AUTO_INCREMENT PRIMARY KEY,
|
logId BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||||
userId BIGINT NOT NULL,
|
userId BIGINT NOT NULL,
|
||||||
storeId BIGINT NULL,
|
storeId BIGINT NULL,
|
||||||
|
usernameSnapshot VARCHAR(50) NULL,
|
||||||
|
fullNameSnapshot VARCHAR(100) NULL,
|
||||||
|
roleSnapshot VARCHAR(20) NULL,
|
||||||
|
storeNameSnapshot VARCHAR(100) NULL,
|
||||||
activity TEXT NOT NULL,
|
activity TEXT NOT NULL,
|
||||||
logTimestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
logTimestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
CONSTRAINT fk_activity_log_user FOREIGN KEY (userId) REFERENCES users(id),
|
CONSTRAINT fk_activity_log_user FOREIGN KEY (userId) REFERENCES users(id),
|
||||||
@@ -339,3 +366,4 @@ CREATE INDEX idx_cart_user ON cart(userId);
|
|||||||
CREATE INDEX idx_conversation_customer ON conversation(customerId);
|
CREATE INDEX idx_conversation_customer ON conversation(customerId);
|
||||||
CREATE INDEX idx_conversation_staff ON conversation(staffId);
|
CREATE INDEX idx_conversation_staff ON conversation(staffId);
|
||||||
CREATE INDEX idx_activity_log_store ON activityLog(storeId);
|
CREATE INDEX idx_activity_log_store ON activityLog(storeId);
|
||||||
|
CREATE INDEX idx_activity_log_timestamp_id ON activityLog(logTimestamp, logId);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ SET FOREIGN_KEY_CHECKS = 0;
|
|||||||
DELETE FROM activityLog;
|
DELETE FROM activityLog;
|
||||||
DELETE FROM message;
|
DELETE FROM message;
|
||||||
DELETE FROM conversation;
|
DELETE FROM conversation;
|
||||||
|
DELETE FROM passwordResetToken;
|
||||||
DELETE FROM refund_item;
|
DELETE FROM refund_item;
|
||||||
DELETE FROM refund;
|
DELETE FROM refund;
|
||||||
DELETE FROM saleItem;
|
DELETE FROM saleItem;
|
||||||
@@ -45,6 +46,7 @@ ALTER TABLE refund AUTO_INCREMENT = 1;
|
|||||||
ALTER TABLE refund_item AUTO_INCREMENT = 1;
|
ALTER TABLE refund_item AUTO_INCREMENT = 1;
|
||||||
ALTER TABLE conversation AUTO_INCREMENT = 1;
|
ALTER TABLE conversation AUTO_INCREMENT = 1;
|
||||||
ALTER TABLE message AUTO_INCREMENT = 1;
|
ALTER TABLE message AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE passwordResetToken AUTO_INCREMENT = 1;
|
||||||
ALTER TABLE activityLog AUTO_INCREMENT = 1;
|
ALTER TABLE activityLog AUTO_INCREMENT = 1;
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
@@ -1739,3 +1741,509 @@ INSERT INTO message (id, conversationId, senderId, content, attachmentUrl, attac
|
|||||||
(118, 30, 8, 'Happy to help. Please share the order number or the pet name involved.', NULL, NULL, NULL, NULL, '2026-03-02 09:05:00', 1),
|
(118, 30, 8, 'Happy to help. Please share the order number or the pet name involved.', NULL, NULL, NULL, NULL, '2026-03-02 09:05:00', 1),
|
||||||
(119, 30, 45, 'Order #1030 is the one I meant, and the pet is Kiki.', NULL, NULL, NULL, NULL, '2026-03-02 09:10:00', 1),
|
(119, 30, 45, 'Order #1030 is the one I meant, and the pet is Kiki.', NULL, NULL, NULL, NULL, '2026-03-02 09:10:00', 1),
|
||||||
(120, 30, 8, 'Thanks, the account and order are now updated on this conversation.', NULL, NULL, NULL, NULL, '2026-03-02 09:15:00', 0);
|
(120, 30, 8, 'Thanks, the account and order are now updated on this conversation.', NULL, NULL, NULL, NULL, '2026-03-02 09:15:00', 0);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO users (username, password, email, firstName, lastName, fullName, phone, avatarUrl, role, staffRole, primaryStoreId, loyaltyPoints, active, tokenVersion)
|
||||||
|
SELECT 'ai.bot',
|
||||||
|
'$2a$10$mE0D/HrnCuqFeEqMy0NJwuy2jkoRYjQ7GrKcc/7QQ0r2AqnZTvyGq',
|
||||||
|
'bot@petshop.com',
|
||||||
|
'AI',
|
||||||
|
'Bot',
|
||||||
|
'AI Bot',
|
||||||
|
'000-000-0000',
|
||||||
|
'https://images.petshop.local/users/bot.webp',
|
||||||
|
'STAFF',
|
||||||
|
'CUSTOMER_SERVICE',
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
FROM DUAL
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM users
|
||||||
|
WHERE username = 'ai.bot'
|
||||||
|
);
|
||||||
|
|
||||||
|
UPDATE users
|
||||||
|
SET
|
||||||
|
username = CASE id
|
||||||
|
WHEN 15 THEN 'customer'
|
||||||
|
WHEN 16 THEN 'maya.brown'
|
||||||
|
WHEN 17 THEN 'noah.clark'
|
||||||
|
WHEN 18 THEN 'avery.wilson'
|
||||||
|
WHEN 19 THEN 'leah.martinez'
|
||||||
|
WHEN 20 THEN 'julian.anderson'
|
||||||
|
WHEN 21 THEN 'zoe.taylor'
|
||||||
|
WHEN 22 THEN 'ethan.parker'
|
||||||
|
WHEN 23 THEN 'ruby.evans'
|
||||||
|
WHEN 24 THEN 'caleb.scott'
|
||||||
|
WHEN 25 THEN 'ivy.adams'
|
||||||
|
WHEN 26 THEN 'isaac.baker'
|
||||||
|
WHEN 27 THEN 'hannah.hall'
|
||||||
|
WHEN 28 THEN 'mason.rivera'
|
||||||
|
WHEN 29 THEN 'aria.mitchell'
|
||||||
|
WHEN 30 THEN 'wyatt.collins'
|
||||||
|
WHEN 31 THEN 'elena.morris'
|
||||||
|
WHEN 32 THEN 'leo.cook'
|
||||||
|
WHEN 33 THEN 'grace.bell'
|
||||||
|
WHEN 34 THEN 'hudson.reed'
|
||||||
|
WHEN 35 THEN 'claire.murphy'
|
||||||
|
WHEN 36 THEN 'omar.bailey'
|
||||||
|
WHEN 37 THEN 'naomi.cooper'
|
||||||
|
WHEN 38 THEN 'jasper.richardson'
|
||||||
|
WHEN 39 THEN 'sofia.cox'
|
||||||
|
WHEN 40 THEN 'miles.howard'
|
||||||
|
WHEN 41 THEN 'audrey.ward'
|
||||||
|
WHEN 42 THEN 'nathan.torres'
|
||||||
|
WHEN 43 THEN 'jade.peterson'
|
||||||
|
WHEN 44 THEN 'rowan.gray'
|
||||||
|
WHEN 45 THEN 'lila.ramirez'
|
||||||
|
WHEN 46 THEN 'eli.james'
|
||||||
|
WHEN 47 THEN 'violet.watson'
|
||||||
|
WHEN 48 THEN 'gavin.brooks'
|
||||||
|
WHEN 49 THEN 'stella.kelly'
|
||||||
|
WHEN 50 THEN 'adrian.sanders'
|
||||||
|
WHEN 51 THEN 'hazel.price'
|
||||||
|
WHEN 52 THEN 'connor.bennett'
|
||||||
|
WHEN 53 THEN 'sadie.wood'
|
||||||
|
WHEN 54 THEN 'xavier.barnes'
|
||||||
|
WHEN 55 THEN 'alice.ross'
|
||||||
|
WHEN 56 THEN 'roman.henderson'
|
||||||
|
WHEN 57 THEN 'lucy.coleman'
|
||||||
|
WHEN 58 THEN 'evan.jenkins'
|
||||||
|
WHEN 59 THEN 'mila.perry'
|
||||||
|
WHEN 60 THEN 'cole.powell'
|
||||||
|
WHEN 61 THEN 'nora.long'
|
||||||
|
WHEN 62 THEN 'adam.patterson'
|
||||||
|
WHEN 63 THEN 'layla.hughes'
|
||||||
|
WHEN 64 THEN 'blake.flores'
|
||||||
|
WHEN 65 THEN 'ellie.washington'
|
||||||
|
WHEN 66 THEN 'ryan.butler'
|
||||||
|
WHEN 67 THEN 'cora.simmons'
|
||||||
|
WHEN 68 THEN 'simon.foster'
|
||||||
|
WHEN 69 THEN 'piper.gonzales'
|
||||||
|
WHEN 70 THEN 'joel.bryant'
|
||||||
|
WHEN 71 THEN 'eva.alexander'
|
||||||
|
WHEN 72 THEN 'felix.russell'
|
||||||
|
WHEN 73 THEN 'maeve.griffin'
|
||||||
|
WHEN 74 THEN 'tristan.diaz'
|
||||||
|
WHEN 75 THEN 'ariana.hayes'
|
||||||
|
WHEN 76 THEN 'declan.myers'
|
||||||
|
WHEN 77 THEN 'brooke.ford'
|
||||||
|
WHEN 78 THEN 'micah.hamilton'
|
||||||
|
WHEN 79 THEN 'bianca.graham'
|
||||||
|
WHEN 80 THEN 'jonah.sullivan'
|
||||||
|
WHEN 81 THEN 'tessa.wallace'
|
||||||
|
WHEN 82 THEN 'damian.woods'
|
||||||
|
WHEN 83 THEN 'riley.cole'
|
||||||
|
WHEN 84 THEN 'kieran.west'
|
||||||
|
WHEN 85 THEN 'sienna.jordan'
|
||||||
|
WHEN 86 THEN 'finley.owens'
|
||||||
|
WHEN 87 THEN 'maren.reynolds'
|
||||||
|
WHEN 88 THEN 'asher.fisher'
|
||||||
|
WHEN 89 THEN 'daphne.ellis'
|
||||||
|
WHEN 90 THEN 'bennett.harrison'
|
||||||
|
WHEN 91 THEN 'selena.gibson'
|
||||||
|
WHEN 92 THEN 'emmett.mcdonald'
|
||||||
|
WHEN 93 THEN 'phoebe.cruz'
|
||||||
|
WHEN 94 THEN 'sawyer.marshall'
|
||||||
|
WHEN 95 THEN 'keira.ortiz'
|
||||||
|
WHEN 96 THEN 'landon.gomez'
|
||||||
|
WHEN 97 THEN 'rosalie.murray'
|
||||||
|
WHEN 98 THEN 'malik.freeman'
|
||||||
|
WHEN 99 THEN 'esme.wells'
|
||||||
|
WHEN 100 THEN 'holden.webb'
|
||||||
|
ELSE username
|
||||||
|
END,
|
||||||
|
email = CASE id
|
||||||
|
WHEN 15 THEN 'customer@petshop.com'
|
||||||
|
WHEN 16 THEN 'maya.brown@gmail.com'
|
||||||
|
WHEN 17 THEN 'noah.clark@gmail.com'
|
||||||
|
WHEN 18 THEN 'avery.wilson@gmail.com'
|
||||||
|
WHEN 19 THEN 'leah.martinez@gmail.com'
|
||||||
|
WHEN 20 THEN 'julian.anderson@gmail.com'
|
||||||
|
WHEN 21 THEN 'zoe.taylor@gmail.com'
|
||||||
|
WHEN 22 THEN 'ethan.parker@gmail.com'
|
||||||
|
WHEN 23 THEN 'ruby.evans@gmail.com'
|
||||||
|
WHEN 24 THEN 'caleb.scott@gmail.com'
|
||||||
|
WHEN 25 THEN 'ivy.adams@gmail.com'
|
||||||
|
WHEN 26 THEN 'isaac.baker@gmail.com'
|
||||||
|
WHEN 27 THEN 'hannah.hall@gmail.com'
|
||||||
|
WHEN 28 THEN 'mason.rivera@gmail.com'
|
||||||
|
WHEN 29 THEN 'aria.mitchell@gmail.com'
|
||||||
|
WHEN 30 THEN 'wyatt.collins@gmail.com'
|
||||||
|
WHEN 31 THEN 'elena.morris@gmail.com'
|
||||||
|
WHEN 32 THEN 'leo.cook@gmail.com'
|
||||||
|
WHEN 33 THEN 'grace.bell@gmail.com'
|
||||||
|
WHEN 34 THEN 'hudson.reed@gmail.com'
|
||||||
|
WHEN 35 THEN 'claire.murphy@gmail.com'
|
||||||
|
WHEN 36 THEN 'omar.bailey@gmail.com'
|
||||||
|
WHEN 37 THEN 'naomi.cooper@gmail.com'
|
||||||
|
WHEN 38 THEN 'jasper.richardson@gmail.com'
|
||||||
|
WHEN 39 THEN 'sofia.cox@gmail.com'
|
||||||
|
WHEN 40 THEN 'miles.howard@gmail.com'
|
||||||
|
WHEN 41 THEN 'audrey.ward@gmail.com'
|
||||||
|
WHEN 42 THEN 'nathan.torres@gmail.com'
|
||||||
|
WHEN 43 THEN 'jade.peterson@gmail.com'
|
||||||
|
WHEN 44 THEN 'rowan.gray@gmail.com'
|
||||||
|
WHEN 45 THEN 'lila.ramirez@gmail.com'
|
||||||
|
WHEN 46 THEN 'eli.james@gmail.com'
|
||||||
|
WHEN 47 THEN 'violet.watson@gmail.com'
|
||||||
|
WHEN 48 THEN 'gavin.brooks@gmail.com'
|
||||||
|
WHEN 49 THEN 'stella.kelly@gmail.com'
|
||||||
|
WHEN 50 THEN 'adrian.sanders@gmail.com'
|
||||||
|
WHEN 51 THEN 'hazel.price@gmail.com'
|
||||||
|
WHEN 52 THEN 'connor.bennett@gmail.com'
|
||||||
|
WHEN 53 THEN 'sadie.wood@gmail.com'
|
||||||
|
WHEN 54 THEN 'xavier.barnes@gmail.com'
|
||||||
|
WHEN 55 THEN 'alice.ross@gmail.com'
|
||||||
|
WHEN 56 THEN 'roman.henderson@gmail.com'
|
||||||
|
WHEN 57 THEN 'lucy.coleman@gmail.com'
|
||||||
|
WHEN 58 THEN 'evan.jenkins@gmail.com'
|
||||||
|
WHEN 59 THEN 'mila.perry@gmail.com'
|
||||||
|
WHEN 60 THEN 'cole.powell@gmail.com'
|
||||||
|
WHEN 61 THEN 'nora.long@gmail.com'
|
||||||
|
WHEN 62 THEN 'adam.patterson@gmail.com'
|
||||||
|
WHEN 63 THEN 'layla.hughes@gmail.com'
|
||||||
|
WHEN 64 THEN 'blake.flores@gmail.com'
|
||||||
|
WHEN 65 THEN 'ellie.washington@gmail.com'
|
||||||
|
WHEN 66 THEN 'ryan.butler@gmail.com'
|
||||||
|
WHEN 67 THEN 'cora.simmons@gmail.com'
|
||||||
|
WHEN 68 THEN 'simon.foster@gmail.com'
|
||||||
|
WHEN 69 THEN 'piper.gonzales@gmail.com'
|
||||||
|
WHEN 70 THEN 'joel.bryant@gmail.com'
|
||||||
|
WHEN 71 THEN 'eva.alexander@gmail.com'
|
||||||
|
WHEN 72 THEN 'felix.russell@gmail.com'
|
||||||
|
WHEN 73 THEN 'maeve.griffin@gmail.com'
|
||||||
|
WHEN 74 THEN 'tristan.diaz@gmail.com'
|
||||||
|
WHEN 75 THEN 'ariana.hayes@gmail.com'
|
||||||
|
WHEN 76 THEN 'declan.myers@gmail.com'
|
||||||
|
WHEN 77 THEN 'brooke.ford@gmail.com'
|
||||||
|
WHEN 78 THEN 'micah.hamilton@gmail.com'
|
||||||
|
WHEN 79 THEN 'bianca.graham@gmail.com'
|
||||||
|
WHEN 80 THEN 'jonah.sullivan@gmail.com'
|
||||||
|
WHEN 81 THEN 'tessa.wallace@gmail.com'
|
||||||
|
WHEN 82 THEN 'damian.woods@gmail.com'
|
||||||
|
WHEN 83 THEN 'riley.cole@gmail.com'
|
||||||
|
WHEN 84 THEN 'kieran.west@gmail.com'
|
||||||
|
WHEN 85 THEN 'sienna.jordan@gmail.com'
|
||||||
|
WHEN 86 THEN 'finley.owens@gmail.com'
|
||||||
|
WHEN 87 THEN 'maren.reynolds@gmail.com'
|
||||||
|
WHEN 88 THEN 'asher.fisher@gmail.com'
|
||||||
|
WHEN 89 THEN 'daphne.ellis@gmail.com'
|
||||||
|
WHEN 90 THEN 'bennett.harrison@gmail.com'
|
||||||
|
WHEN 91 THEN 'selena.gibson@gmail.com'
|
||||||
|
WHEN 92 THEN 'emmett.mcdonald@gmail.com'
|
||||||
|
WHEN 93 THEN 'phoebe.cruz@gmail.com'
|
||||||
|
WHEN 94 THEN 'sawyer.marshall@gmail.com'
|
||||||
|
WHEN 95 THEN 'keira.ortiz@gmail.com'
|
||||||
|
WHEN 96 THEN 'landon.gomez@gmail.com'
|
||||||
|
WHEN 97 THEN 'rosalie.murray@gmail.com'
|
||||||
|
WHEN 98 THEN 'malik.freeman@gmail.com'
|
||||||
|
WHEN 99 THEN 'esme.wells@gmail.com'
|
||||||
|
WHEN 100 THEN 'holden.webb@gmail.com'
|
||||||
|
ELSE email
|
||||||
|
END,
|
||||||
|
firstName = CASE id
|
||||||
|
WHEN 15 THEN 'Test'
|
||||||
|
WHEN 16 THEN 'Maya'
|
||||||
|
WHEN 17 THEN 'Noah'
|
||||||
|
WHEN 18 THEN 'Avery'
|
||||||
|
WHEN 19 THEN 'Leah'
|
||||||
|
WHEN 20 THEN 'Julian'
|
||||||
|
WHEN 21 THEN 'Zoe'
|
||||||
|
WHEN 22 THEN 'Ethan'
|
||||||
|
WHEN 23 THEN 'Ruby'
|
||||||
|
WHEN 24 THEN 'Caleb'
|
||||||
|
WHEN 25 THEN 'Ivy'
|
||||||
|
WHEN 26 THEN 'Isaac'
|
||||||
|
WHEN 27 THEN 'Hannah'
|
||||||
|
WHEN 28 THEN 'Mason'
|
||||||
|
WHEN 29 THEN 'Aria'
|
||||||
|
WHEN 30 THEN 'Wyatt'
|
||||||
|
WHEN 31 THEN 'Elena'
|
||||||
|
WHEN 32 THEN 'Leo'
|
||||||
|
WHEN 33 THEN 'Grace'
|
||||||
|
WHEN 34 THEN 'Hudson'
|
||||||
|
WHEN 35 THEN 'Claire'
|
||||||
|
WHEN 36 THEN 'Omar'
|
||||||
|
WHEN 37 THEN 'Naomi'
|
||||||
|
WHEN 38 THEN 'Jasper'
|
||||||
|
WHEN 39 THEN 'Sofia'
|
||||||
|
WHEN 40 THEN 'Miles'
|
||||||
|
WHEN 41 THEN 'Audrey'
|
||||||
|
WHEN 42 THEN 'Nathan'
|
||||||
|
WHEN 43 THEN 'Jade'
|
||||||
|
WHEN 44 THEN 'Rowan'
|
||||||
|
WHEN 45 THEN 'Lila'
|
||||||
|
WHEN 46 THEN 'Eli'
|
||||||
|
WHEN 47 THEN 'Violet'
|
||||||
|
WHEN 48 THEN 'Gavin'
|
||||||
|
WHEN 49 THEN 'Stella'
|
||||||
|
WHEN 50 THEN 'Adrian'
|
||||||
|
WHEN 51 THEN 'Hazel'
|
||||||
|
WHEN 52 THEN 'Connor'
|
||||||
|
WHEN 53 THEN 'Sadie'
|
||||||
|
WHEN 54 THEN 'Xavier'
|
||||||
|
WHEN 55 THEN 'Alice'
|
||||||
|
WHEN 56 THEN 'Roman'
|
||||||
|
WHEN 57 THEN 'Lucy'
|
||||||
|
WHEN 58 THEN 'Evan'
|
||||||
|
WHEN 59 THEN 'Mila'
|
||||||
|
WHEN 60 THEN 'Cole'
|
||||||
|
WHEN 61 THEN 'Nora'
|
||||||
|
WHEN 62 THEN 'Adam'
|
||||||
|
WHEN 63 THEN 'Layla'
|
||||||
|
WHEN 64 THEN 'Blake'
|
||||||
|
WHEN 65 THEN 'Ellie'
|
||||||
|
WHEN 66 THEN 'Ryan'
|
||||||
|
WHEN 67 THEN 'Cora'
|
||||||
|
WHEN 68 THEN 'Simon'
|
||||||
|
WHEN 69 THEN 'Piper'
|
||||||
|
WHEN 70 THEN 'Joel'
|
||||||
|
WHEN 71 THEN 'Eva'
|
||||||
|
WHEN 72 THEN 'Felix'
|
||||||
|
WHEN 73 THEN 'Maeve'
|
||||||
|
WHEN 74 THEN 'Tristan'
|
||||||
|
WHEN 75 THEN 'Ariana'
|
||||||
|
WHEN 76 THEN 'Declan'
|
||||||
|
WHEN 77 THEN 'Brooke'
|
||||||
|
WHEN 78 THEN 'Micah'
|
||||||
|
WHEN 79 THEN 'Bianca'
|
||||||
|
WHEN 80 THEN 'Jonah'
|
||||||
|
WHEN 81 THEN 'Tessa'
|
||||||
|
WHEN 82 THEN 'Damian'
|
||||||
|
WHEN 83 THEN 'Riley'
|
||||||
|
WHEN 84 THEN 'Kieran'
|
||||||
|
WHEN 85 THEN 'Sienna'
|
||||||
|
WHEN 86 THEN 'Finley'
|
||||||
|
WHEN 87 THEN 'Maren'
|
||||||
|
WHEN 88 THEN 'Asher'
|
||||||
|
WHEN 89 THEN 'Daphne'
|
||||||
|
WHEN 90 THEN 'Bennett'
|
||||||
|
WHEN 91 THEN 'Selena'
|
||||||
|
WHEN 92 THEN 'Emmett'
|
||||||
|
WHEN 93 THEN 'Phoebe'
|
||||||
|
WHEN 94 THEN 'Sawyer'
|
||||||
|
WHEN 95 THEN 'Keira'
|
||||||
|
WHEN 96 THEN 'Landon'
|
||||||
|
WHEN 97 THEN 'Rosalie'
|
||||||
|
WHEN 98 THEN 'Malik'
|
||||||
|
WHEN 99 THEN 'Esme'
|
||||||
|
WHEN 100 THEN 'Holden'
|
||||||
|
ELSE firstName
|
||||||
|
END,
|
||||||
|
fullName = CASE id
|
||||||
|
WHEN 15 THEN 'Test Customer'
|
||||||
|
WHEN 16 THEN 'Maya Brown'
|
||||||
|
WHEN 17 THEN 'Noah Clark'
|
||||||
|
WHEN 18 THEN 'Avery Wilson'
|
||||||
|
WHEN 19 THEN 'Leah Martinez'
|
||||||
|
WHEN 20 THEN 'Julian Anderson'
|
||||||
|
WHEN 21 THEN 'Zoe Taylor'
|
||||||
|
WHEN 22 THEN 'Ethan Parker'
|
||||||
|
WHEN 23 THEN 'Ruby Evans'
|
||||||
|
WHEN 24 THEN 'Caleb Scott'
|
||||||
|
WHEN 25 THEN 'Ivy Adams'
|
||||||
|
WHEN 26 THEN 'Isaac Baker'
|
||||||
|
WHEN 27 THEN 'Hannah Hall'
|
||||||
|
WHEN 28 THEN 'Mason Rivera'
|
||||||
|
WHEN 29 THEN 'Aria Mitchell'
|
||||||
|
WHEN 30 THEN 'Wyatt Collins'
|
||||||
|
WHEN 31 THEN 'Elena Morris'
|
||||||
|
WHEN 32 THEN 'Leo Cook'
|
||||||
|
WHEN 33 THEN 'Grace Bell'
|
||||||
|
WHEN 34 THEN 'Hudson Reed'
|
||||||
|
WHEN 35 THEN 'Claire Murphy'
|
||||||
|
WHEN 36 THEN 'Omar Bailey'
|
||||||
|
WHEN 37 THEN 'Naomi Cooper'
|
||||||
|
WHEN 38 THEN 'Jasper Richardson'
|
||||||
|
WHEN 39 THEN 'Sofia Cox'
|
||||||
|
WHEN 40 THEN 'Miles Howard'
|
||||||
|
WHEN 41 THEN 'Audrey Ward'
|
||||||
|
WHEN 42 THEN 'Nathan Torres'
|
||||||
|
WHEN 43 THEN 'Jade Peterson'
|
||||||
|
WHEN 44 THEN 'Rowan Gray'
|
||||||
|
WHEN 45 THEN 'Lila Ramirez'
|
||||||
|
WHEN 46 THEN 'Eli James'
|
||||||
|
WHEN 47 THEN 'Violet Watson'
|
||||||
|
WHEN 48 THEN 'Gavin Brooks'
|
||||||
|
WHEN 49 THEN 'Stella Kelly'
|
||||||
|
WHEN 50 THEN 'Adrian Sanders'
|
||||||
|
WHEN 51 THEN 'Hazel Price'
|
||||||
|
WHEN 52 THEN 'Connor Bennett'
|
||||||
|
WHEN 53 THEN 'Sadie Wood'
|
||||||
|
WHEN 54 THEN 'Xavier Barnes'
|
||||||
|
WHEN 55 THEN 'Alice Ross'
|
||||||
|
WHEN 56 THEN 'Roman Henderson'
|
||||||
|
WHEN 57 THEN 'Lucy Coleman'
|
||||||
|
WHEN 58 THEN 'Evan Jenkins'
|
||||||
|
WHEN 59 THEN 'Mila Perry'
|
||||||
|
WHEN 60 THEN 'Cole Powell'
|
||||||
|
WHEN 61 THEN 'Nora Long'
|
||||||
|
WHEN 62 THEN 'Adam Patterson'
|
||||||
|
WHEN 63 THEN 'Layla Hughes'
|
||||||
|
WHEN 64 THEN 'Blake Flores'
|
||||||
|
WHEN 65 THEN 'Ellie Washington'
|
||||||
|
WHEN 66 THEN 'Ryan Butler'
|
||||||
|
WHEN 67 THEN 'Cora Simmons'
|
||||||
|
WHEN 68 THEN 'Simon Foster'
|
||||||
|
WHEN 69 THEN 'Piper Gonzales'
|
||||||
|
WHEN 70 THEN 'Joel Bryant'
|
||||||
|
WHEN 71 THEN 'Eva Alexander'
|
||||||
|
WHEN 72 THEN 'Felix Russell'
|
||||||
|
WHEN 73 THEN 'Maeve Griffin'
|
||||||
|
WHEN 74 THEN 'Tristan Diaz'
|
||||||
|
WHEN 75 THEN 'Ariana Hayes'
|
||||||
|
WHEN 76 THEN 'Declan Myers'
|
||||||
|
WHEN 77 THEN 'Brooke Ford'
|
||||||
|
WHEN 78 THEN 'Micah Hamilton'
|
||||||
|
WHEN 79 THEN 'Bianca Graham'
|
||||||
|
WHEN 80 THEN 'Jonah Sullivan'
|
||||||
|
WHEN 81 THEN 'Tessa Wallace'
|
||||||
|
WHEN 82 THEN 'Damian Woods'
|
||||||
|
WHEN 83 THEN 'Riley Cole'
|
||||||
|
WHEN 84 THEN 'Kieran West'
|
||||||
|
WHEN 85 THEN 'Sienna Jordan'
|
||||||
|
WHEN 86 THEN 'Finley Owens'
|
||||||
|
WHEN 87 THEN 'Maren Reynolds'
|
||||||
|
WHEN 88 THEN 'Asher Fisher'
|
||||||
|
WHEN 89 THEN 'Daphne Ellis'
|
||||||
|
WHEN 90 THEN 'Bennett Harrison'
|
||||||
|
WHEN 91 THEN 'Selena Gibson'
|
||||||
|
WHEN 92 THEN 'Emmett Mcdonald'
|
||||||
|
WHEN 93 THEN 'Phoebe Cruz'
|
||||||
|
WHEN 94 THEN 'Sawyer Marshall'
|
||||||
|
WHEN 95 THEN 'Keira Ortiz'
|
||||||
|
WHEN 96 THEN 'Landon Gomez'
|
||||||
|
WHEN 97 THEN 'Rosalie Murray'
|
||||||
|
WHEN 98 THEN 'Malik Freeman'
|
||||||
|
WHEN 99 THEN 'Esme Wells'
|
||||||
|
WHEN 100 THEN 'Holden Webb'
|
||||||
|
ELSE fullName
|
||||||
|
END,
|
||||||
|
primaryStoreId = CASE id
|
||||||
|
WHEN 15 THEN 1
|
||||||
|
WHEN 16 THEN 2
|
||||||
|
WHEN 17 THEN 3
|
||||||
|
WHEN 18 THEN 1
|
||||||
|
WHEN 19 THEN 2
|
||||||
|
WHEN 20 THEN 3
|
||||||
|
WHEN 21 THEN 1
|
||||||
|
WHEN 22 THEN 2
|
||||||
|
WHEN 23 THEN 3
|
||||||
|
WHEN 24 THEN 1
|
||||||
|
WHEN 25 THEN 2
|
||||||
|
WHEN 26 THEN 3
|
||||||
|
WHEN 27 THEN 1
|
||||||
|
WHEN 28 THEN 2
|
||||||
|
WHEN 29 THEN 3
|
||||||
|
WHEN 30 THEN 1
|
||||||
|
WHEN 31 THEN 2
|
||||||
|
WHEN 32 THEN 3
|
||||||
|
WHEN 33 THEN 1
|
||||||
|
WHEN 34 THEN 2
|
||||||
|
WHEN 35 THEN 3
|
||||||
|
WHEN 36 THEN 1
|
||||||
|
WHEN 37 THEN 2
|
||||||
|
WHEN 38 THEN 3
|
||||||
|
WHEN 39 THEN 1
|
||||||
|
WHEN 40 THEN 2
|
||||||
|
WHEN 41 THEN 3
|
||||||
|
WHEN 42 THEN 1
|
||||||
|
WHEN 43 THEN 2
|
||||||
|
WHEN 44 THEN 3
|
||||||
|
WHEN 45 THEN 1
|
||||||
|
WHEN 46 THEN 2
|
||||||
|
WHEN 47 THEN 3
|
||||||
|
WHEN 48 THEN 1
|
||||||
|
WHEN 49 THEN 2
|
||||||
|
WHEN 50 THEN 3
|
||||||
|
WHEN 51 THEN 1
|
||||||
|
WHEN 52 THEN 2
|
||||||
|
WHEN 53 THEN 3
|
||||||
|
WHEN 54 THEN 1
|
||||||
|
WHEN 55 THEN 2
|
||||||
|
WHEN 56 THEN 3
|
||||||
|
WHEN 57 THEN 1
|
||||||
|
WHEN 58 THEN 2
|
||||||
|
WHEN 59 THEN 3
|
||||||
|
WHEN 60 THEN 1
|
||||||
|
WHEN 61 THEN 2
|
||||||
|
WHEN 62 THEN 3
|
||||||
|
WHEN 63 THEN 1
|
||||||
|
WHEN 64 THEN 2
|
||||||
|
WHEN 65 THEN 3
|
||||||
|
WHEN 66 THEN 1
|
||||||
|
WHEN 67 THEN 2
|
||||||
|
WHEN 68 THEN 3
|
||||||
|
WHEN 69 THEN 1
|
||||||
|
WHEN 70 THEN 2
|
||||||
|
WHEN 71 THEN 3
|
||||||
|
WHEN 72 THEN 1
|
||||||
|
WHEN 73 THEN 2
|
||||||
|
WHEN 74 THEN 3
|
||||||
|
WHEN 75 THEN 1
|
||||||
|
WHEN 76 THEN 2
|
||||||
|
WHEN 77 THEN 3
|
||||||
|
WHEN 78 THEN 1
|
||||||
|
WHEN 79 THEN 2
|
||||||
|
WHEN 80 THEN 3
|
||||||
|
WHEN 81 THEN 1
|
||||||
|
WHEN 82 THEN 2
|
||||||
|
WHEN 83 THEN 3
|
||||||
|
WHEN 84 THEN 1
|
||||||
|
WHEN 85 THEN 2
|
||||||
|
WHEN 86 THEN 3
|
||||||
|
WHEN 87 THEN 1
|
||||||
|
WHEN 88 THEN 2
|
||||||
|
WHEN 89 THEN 3
|
||||||
|
WHEN 90 THEN 1
|
||||||
|
WHEN 91 THEN 2
|
||||||
|
WHEN 92 THEN 3
|
||||||
|
WHEN 93 THEN 1
|
||||||
|
WHEN 94 THEN 2
|
||||||
|
WHEN 95 THEN 3
|
||||||
|
WHEN 96 THEN 1
|
||||||
|
WHEN 97 THEN 2
|
||||||
|
WHEN 98 THEN 3
|
||||||
|
WHEN 99 THEN 1
|
||||||
|
WHEN 100 THEN 2
|
||||||
|
ELSE primaryStoreId
|
||||||
|
END
|
||||||
|
WHERE id BETWEEN 15 AND 100;
|
||||||
|
|
||||||
|
UPDATE users
|
||||||
|
SET fullName = TRIM(CONCAT_WS(' ', firstName, lastName))
|
||||||
|
WHERE (fullName IS NULL OR fullName = '')
|
||||||
|
AND ((firstName IS NOT NULL AND firstName <> '') OR (lastName IS NOT NULL AND lastName <> ''));
|
||||||
|
|
||||||
|
UPDATE activityLog al
|
||||||
|
LEFT JOIN users u ON u.id = al.userId
|
||||||
|
LEFT JOIN storeLocation s ON s.storeId = al.storeId
|
||||||
|
SET al.usernameSnapshot = COALESCE(al.usernameSnapshot, u.username),
|
||||||
|
al.fullNameSnapshot = COALESCE(al.fullNameSnapshot, COALESCE(NULLIF(u.fullName, ''), TRIM(CONCAT_WS(' ', u.firstName, u.lastName)))),
|
||||||
|
al.roleSnapshot = COALESCE(al.roleSnapshot, u.role),
|
||||||
|
al.storeNameSnapshot = COALESCE(al.storeNameSnapshot, s.storeName)
|
||||||
|
WHERE al.usernameSnapshot IS NULL
|
||||||
|
OR al.fullNameSnapshot IS NULL
|
||||||
|
OR al.roleSnapshot IS NULL
|
||||||
|
OR (al.storeId IS NOT NULL AND al.storeNameSnapshot IS NULL);
|
||||||
|
|
||||||
|
|
||||||
|
UPDATE users
|
||||||
|
SET avatarUrl = REPLACE(avatarUrl, 'https://images.petshop.local/users/', '/uploads/avatars/')
|
||||||
|
WHERE avatarUrl LIKE 'https://images.petshop.local/users/%';
|
||||||
|
|
||||||
|
UPDATE pet
|
||||||
|
SET imageUrl = REPLACE(imageUrl, 'https://images.petshop.local/pets/', '/uploads/pets/')
|
||||||
|
WHERE imageUrl LIKE 'https://images.petshop.local/pets/%';
|
||||||
|
|
||||||
|
UPDATE product
|
||||||
|
SET imageUrl = REPLACE(imageUrl, 'https://images.petshop.local/products/', '/uploads/products/')
|
||||||
|
WHERE imageUrl LIKE 'https://images.petshop.local/products/%';
|
||||||
|
|
||||||
|
UPDATE storeLocation
|
||||||
|
SET imageUrl = REPLACE(imageUrl, 'https://images.petshop.local/stores/', '/stores/')
|
||||||
|
WHERE imageUrl LIKE 'https://images.petshop.local/stores/%';
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
INSERT INTO users (username, password, email, firstName, lastName, fullName, phone, avatarUrl, role, staffRole, primaryStoreId, loyaltyPoints, active, tokenVersion)
|
|
||||||
SELECT 'ai.bot',
|
|
||||||
'$2a$10$mE0D/HrnCuqFeEqMy0NJwuy2jkoRYjQ7GrKcc/7QQ0r2AqnZTvyGq',
|
|
||||||
'bot@petshop.com',
|
|
||||||
'AI',
|
|
||||||
'Bot',
|
|
||||||
'AI Bot',
|
|
||||||
'000-000-0000',
|
|
||||||
'https://images.petshop.local/users/bot.webp',
|
|
||||||
'STAFF',
|
|
||||||
'CUSTOMER_SERVICE',
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0
|
|
||||||
FROM DUAL
|
|
||||||
WHERE NOT EXISTS (
|
|
||||||
SELECT 1
|
|
||||||
FROM users
|
|
||||||
WHERE username = 'ai.bot'
|
|
||||||
);
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
ALTER TABLE activityLog
|
|
||||||
ADD COLUMN usernameSnapshot VARCHAR(50) NULL,
|
|
||||||
ADD COLUMN fullNameSnapshot VARCHAR(100) NULL,
|
|
||||||
ADD COLUMN roleSnapshot VARCHAR(20) NULL,
|
|
||||||
ADD COLUMN storeNameSnapshot VARCHAR(100) NULL;
|
|
||||||
|
|
||||||
CREATE INDEX idx_activity_log_timestamp_id ON activityLog(logTimestamp, logId);
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
ALTER TABLE sale
|
|
||||||
ADD COLUMN pointsUsed INT NOT NULL DEFAULT 0,
|
|
||||||
ADD COLUMN pointsDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00;
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS passwordResetToken (
|
|
||||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
userId BIGINT NOT NULL,
|
|
||||||
tokenHash VARCHAR(64) NOT NULL,
|
|
||||||
expiresAt DATETIME NOT NULL,
|
|
||||||
usedAt DATETIME NULL,
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
CONSTRAINT uq_password_reset_token_hash UNIQUE (tokenHash),
|
|
||||||
CONSTRAINT fk_password_reset_token_user FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX idx_password_reset_token_user ON passwordResetToken(userId);
|
|
||||||
CREATE INDEX idx_password_reset_token_expires ON passwordResetToken(expiresAt);
|
|
||||||
|
|
||||||
ALTER TABLE sale
|
|
||||||
ADD COLUMN pointsUsed INT NOT NULL DEFAULT 0,
|
|
||||||
ADD COLUMN loyaltyDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00;
|
|
||||||
|
|
||||||
ALTER TABLE cart
|
|
||||||
ADD COLUMN pointsApplied BOOLEAN NOT NULL DEFAULT FALSE,
|
|
||||||
ADD COLUMN pointsDiscountAmount DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
|
|
||||||
ADD COLUMN checkoutPending BOOLEAN NOT NULL DEFAULT FALSE,
|
|
||||||
ADD COLUMN checkoutAmount DECIMAL(10, 2),
|
|
||||||
ADD COLUMN checkoutStartedAt DATETIME,
|
|
||||||
ADD COLUMN checkoutPaymentIntentId VARCHAR(255);
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ALTER TABLE sale ADD CONSTRAINT uq_sale_cart_id UNIQUE (cartId);
|
|
||||||
@@ -1,487 +0,0 @@
|
|||||||
INSERT INTO users (username, password, email, firstName, lastName, fullName, phone, avatarUrl, role, staffRole, primaryStoreId, loyaltyPoints, active, tokenVersion)
|
|
||||||
SELECT 'ai.bot',
|
|
||||||
'$2a$10$mE0D/HrnCuqFeEqMy0NJwuy2jkoRYjQ7GrKcc/7QQ0r2AqnZTvyGq',
|
|
||||||
'bot@petshop.com',
|
|
||||||
'AI',
|
|
||||||
'Bot',
|
|
||||||
'AI Bot',
|
|
||||||
'000-000-0000',
|
|
||||||
'https://images.petshop.local/users/bot.webp',
|
|
||||||
'STAFF',
|
|
||||||
'CUSTOMER_SERVICE',
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0
|
|
||||||
FROM DUAL
|
|
||||||
WHERE NOT EXISTS (
|
|
||||||
SELECT 1
|
|
||||||
FROM users
|
|
||||||
WHERE username = 'ai.bot'
|
|
||||||
);
|
|
||||||
|
|
||||||
UPDATE users
|
|
||||||
SET
|
|
||||||
username = CASE id
|
|
||||||
WHEN 15 THEN 'customer'
|
|
||||||
WHEN 16 THEN 'maya.brown'
|
|
||||||
WHEN 17 THEN 'noah.clark'
|
|
||||||
WHEN 18 THEN 'avery.wilson'
|
|
||||||
WHEN 19 THEN 'leah.martinez'
|
|
||||||
WHEN 20 THEN 'julian.anderson'
|
|
||||||
WHEN 21 THEN 'zoe.taylor'
|
|
||||||
WHEN 22 THEN 'ethan.parker'
|
|
||||||
WHEN 23 THEN 'ruby.evans'
|
|
||||||
WHEN 24 THEN 'caleb.scott'
|
|
||||||
WHEN 25 THEN 'ivy.adams'
|
|
||||||
WHEN 26 THEN 'isaac.baker'
|
|
||||||
WHEN 27 THEN 'hannah.hall'
|
|
||||||
WHEN 28 THEN 'mason.rivera'
|
|
||||||
WHEN 29 THEN 'aria.mitchell'
|
|
||||||
WHEN 30 THEN 'wyatt.collins'
|
|
||||||
WHEN 31 THEN 'elena.morris'
|
|
||||||
WHEN 32 THEN 'leo.cook'
|
|
||||||
WHEN 33 THEN 'grace.bell'
|
|
||||||
WHEN 34 THEN 'hudson.reed'
|
|
||||||
WHEN 35 THEN 'claire.murphy'
|
|
||||||
WHEN 36 THEN 'omar.bailey'
|
|
||||||
WHEN 37 THEN 'naomi.cooper'
|
|
||||||
WHEN 38 THEN 'jasper.richardson'
|
|
||||||
WHEN 39 THEN 'sofia.cox'
|
|
||||||
WHEN 40 THEN 'miles.howard'
|
|
||||||
WHEN 41 THEN 'audrey.ward'
|
|
||||||
WHEN 42 THEN 'nathan.torres'
|
|
||||||
WHEN 43 THEN 'jade.peterson'
|
|
||||||
WHEN 44 THEN 'rowan.gray'
|
|
||||||
WHEN 45 THEN 'lila.ramirez'
|
|
||||||
WHEN 46 THEN 'eli.james'
|
|
||||||
WHEN 47 THEN 'violet.watson'
|
|
||||||
WHEN 48 THEN 'gavin.brooks'
|
|
||||||
WHEN 49 THEN 'stella.kelly'
|
|
||||||
WHEN 50 THEN 'adrian.sanders'
|
|
||||||
WHEN 51 THEN 'hazel.price'
|
|
||||||
WHEN 52 THEN 'connor.bennett'
|
|
||||||
WHEN 53 THEN 'sadie.wood'
|
|
||||||
WHEN 54 THEN 'xavier.barnes'
|
|
||||||
WHEN 55 THEN 'alice.ross'
|
|
||||||
WHEN 56 THEN 'roman.henderson'
|
|
||||||
WHEN 57 THEN 'lucy.coleman'
|
|
||||||
WHEN 58 THEN 'evan.jenkins'
|
|
||||||
WHEN 59 THEN 'mila.perry'
|
|
||||||
WHEN 60 THEN 'cole.powell'
|
|
||||||
WHEN 61 THEN 'nora.long'
|
|
||||||
WHEN 62 THEN 'adam.patterson'
|
|
||||||
WHEN 63 THEN 'layla.hughes'
|
|
||||||
WHEN 64 THEN 'blake.flores'
|
|
||||||
WHEN 65 THEN 'ellie.washington'
|
|
||||||
WHEN 66 THEN 'ryan.butler'
|
|
||||||
WHEN 67 THEN 'cora.simmons'
|
|
||||||
WHEN 68 THEN 'simon.foster'
|
|
||||||
WHEN 69 THEN 'piper.gonzales'
|
|
||||||
WHEN 70 THEN 'joel.bryant'
|
|
||||||
WHEN 71 THEN 'eva.alexander'
|
|
||||||
WHEN 72 THEN 'felix.russell'
|
|
||||||
WHEN 73 THEN 'maeve.griffin'
|
|
||||||
WHEN 74 THEN 'tristan.diaz'
|
|
||||||
WHEN 75 THEN 'ariana.hayes'
|
|
||||||
WHEN 76 THEN 'declan.myers'
|
|
||||||
WHEN 77 THEN 'brooke.ford'
|
|
||||||
WHEN 78 THEN 'micah.hamilton'
|
|
||||||
WHEN 79 THEN 'bianca.graham'
|
|
||||||
WHEN 80 THEN 'jonah.sullivan'
|
|
||||||
WHEN 81 THEN 'tessa.wallace'
|
|
||||||
WHEN 82 THEN 'damian.woods'
|
|
||||||
WHEN 83 THEN 'riley.cole'
|
|
||||||
WHEN 84 THEN 'kieran.west'
|
|
||||||
WHEN 85 THEN 'sienna.jordan'
|
|
||||||
WHEN 86 THEN 'finley.owens'
|
|
||||||
WHEN 87 THEN 'maren.reynolds'
|
|
||||||
WHEN 88 THEN 'asher.fisher'
|
|
||||||
WHEN 89 THEN 'daphne.ellis'
|
|
||||||
WHEN 90 THEN 'bennett.harrison'
|
|
||||||
WHEN 91 THEN 'selena.gibson'
|
|
||||||
WHEN 92 THEN 'emmett.mcdonald'
|
|
||||||
WHEN 93 THEN 'phoebe.cruz'
|
|
||||||
WHEN 94 THEN 'sawyer.marshall'
|
|
||||||
WHEN 95 THEN 'keira.ortiz'
|
|
||||||
WHEN 96 THEN 'landon.gomez'
|
|
||||||
WHEN 97 THEN 'rosalie.murray'
|
|
||||||
WHEN 98 THEN 'malik.freeman'
|
|
||||||
WHEN 99 THEN 'esme.wells'
|
|
||||||
WHEN 100 THEN 'holden.webb'
|
|
||||||
ELSE username
|
|
||||||
END,
|
|
||||||
email = CASE id
|
|
||||||
WHEN 15 THEN 'customer@petshop.com'
|
|
||||||
WHEN 16 THEN 'maya.brown@gmail.com'
|
|
||||||
WHEN 17 THEN 'noah.clark@gmail.com'
|
|
||||||
WHEN 18 THEN 'avery.wilson@gmail.com'
|
|
||||||
WHEN 19 THEN 'leah.martinez@gmail.com'
|
|
||||||
WHEN 20 THEN 'julian.anderson@gmail.com'
|
|
||||||
WHEN 21 THEN 'zoe.taylor@gmail.com'
|
|
||||||
WHEN 22 THEN 'ethan.parker@gmail.com'
|
|
||||||
WHEN 23 THEN 'ruby.evans@gmail.com'
|
|
||||||
WHEN 24 THEN 'caleb.scott@gmail.com'
|
|
||||||
WHEN 25 THEN 'ivy.adams@gmail.com'
|
|
||||||
WHEN 26 THEN 'isaac.baker@gmail.com'
|
|
||||||
WHEN 27 THEN 'hannah.hall@gmail.com'
|
|
||||||
WHEN 28 THEN 'mason.rivera@gmail.com'
|
|
||||||
WHEN 29 THEN 'aria.mitchell@gmail.com'
|
|
||||||
WHEN 30 THEN 'wyatt.collins@gmail.com'
|
|
||||||
WHEN 31 THEN 'elena.morris@gmail.com'
|
|
||||||
WHEN 32 THEN 'leo.cook@gmail.com'
|
|
||||||
WHEN 33 THEN 'grace.bell@gmail.com'
|
|
||||||
WHEN 34 THEN 'hudson.reed@gmail.com'
|
|
||||||
WHEN 35 THEN 'claire.murphy@gmail.com'
|
|
||||||
WHEN 36 THEN 'omar.bailey@gmail.com'
|
|
||||||
WHEN 37 THEN 'naomi.cooper@gmail.com'
|
|
||||||
WHEN 38 THEN 'jasper.richardson@gmail.com'
|
|
||||||
WHEN 39 THEN 'sofia.cox@gmail.com'
|
|
||||||
WHEN 40 THEN 'miles.howard@gmail.com'
|
|
||||||
WHEN 41 THEN 'audrey.ward@gmail.com'
|
|
||||||
WHEN 42 THEN 'nathan.torres@gmail.com'
|
|
||||||
WHEN 43 THEN 'jade.peterson@gmail.com'
|
|
||||||
WHEN 44 THEN 'rowan.gray@gmail.com'
|
|
||||||
WHEN 45 THEN 'lila.ramirez@gmail.com'
|
|
||||||
WHEN 46 THEN 'eli.james@gmail.com'
|
|
||||||
WHEN 47 THEN 'violet.watson@gmail.com'
|
|
||||||
WHEN 48 THEN 'gavin.brooks@gmail.com'
|
|
||||||
WHEN 49 THEN 'stella.kelly@gmail.com'
|
|
||||||
WHEN 50 THEN 'adrian.sanders@gmail.com'
|
|
||||||
WHEN 51 THEN 'hazel.price@gmail.com'
|
|
||||||
WHEN 52 THEN 'connor.bennett@gmail.com'
|
|
||||||
WHEN 53 THEN 'sadie.wood@gmail.com'
|
|
||||||
WHEN 54 THEN 'xavier.barnes@gmail.com'
|
|
||||||
WHEN 55 THEN 'alice.ross@gmail.com'
|
|
||||||
WHEN 56 THEN 'roman.henderson@gmail.com'
|
|
||||||
WHEN 57 THEN 'lucy.coleman@gmail.com'
|
|
||||||
WHEN 58 THEN 'evan.jenkins@gmail.com'
|
|
||||||
WHEN 59 THEN 'mila.perry@gmail.com'
|
|
||||||
WHEN 60 THEN 'cole.powell@gmail.com'
|
|
||||||
WHEN 61 THEN 'nora.long@gmail.com'
|
|
||||||
WHEN 62 THEN 'adam.patterson@gmail.com'
|
|
||||||
WHEN 63 THEN 'layla.hughes@gmail.com'
|
|
||||||
WHEN 64 THEN 'blake.flores@gmail.com'
|
|
||||||
WHEN 65 THEN 'ellie.washington@gmail.com'
|
|
||||||
WHEN 66 THEN 'ryan.butler@gmail.com'
|
|
||||||
WHEN 67 THEN 'cora.simmons@gmail.com'
|
|
||||||
WHEN 68 THEN 'simon.foster@gmail.com'
|
|
||||||
WHEN 69 THEN 'piper.gonzales@gmail.com'
|
|
||||||
WHEN 70 THEN 'joel.bryant@gmail.com'
|
|
||||||
WHEN 71 THEN 'eva.alexander@gmail.com'
|
|
||||||
WHEN 72 THEN 'felix.russell@gmail.com'
|
|
||||||
WHEN 73 THEN 'maeve.griffin@gmail.com'
|
|
||||||
WHEN 74 THEN 'tristan.diaz@gmail.com'
|
|
||||||
WHEN 75 THEN 'ariana.hayes@gmail.com'
|
|
||||||
WHEN 76 THEN 'declan.myers@gmail.com'
|
|
||||||
WHEN 77 THEN 'brooke.ford@gmail.com'
|
|
||||||
WHEN 78 THEN 'micah.hamilton@gmail.com'
|
|
||||||
WHEN 79 THEN 'bianca.graham@gmail.com'
|
|
||||||
WHEN 80 THEN 'jonah.sullivan@gmail.com'
|
|
||||||
WHEN 81 THEN 'tessa.wallace@gmail.com'
|
|
||||||
WHEN 82 THEN 'damian.woods@gmail.com'
|
|
||||||
WHEN 83 THEN 'riley.cole@gmail.com'
|
|
||||||
WHEN 84 THEN 'kieran.west@gmail.com'
|
|
||||||
WHEN 85 THEN 'sienna.jordan@gmail.com'
|
|
||||||
WHEN 86 THEN 'finley.owens@gmail.com'
|
|
||||||
WHEN 87 THEN 'maren.reynolds@gmail.com'
|
|
||||||
WHEN 88 THEN 'asher.fisher@gmail.com'
|
|
||||||
WHEN 89 THEN 'daphne.ellis@gmail.com'
|
|
||||||
WHEN 90 THEN 'bennett.harrison@gmail.com'
|
|
||||||
WHEN 91 THEN 'selena.gibson@gmail.com'
|
|
||||||
WHEN 92 THEN 'emmett.mcdonald@gmail.com'
|
|
||||||
WHEN 93 THEN 'phoebe.cruz@gmail.com'
|
|
||||||
WHEN 94 THEN 'sawyer.marshall@gmail.com'
|
|
||||||
WHEN 95 THEN 'keira.ortiz@gmail.com'
|
|
||||||
WHEN 96 THEN 'landon.gomez@gmail.com'
|
|
||||||
WHEN 97 THEN 'rosalie.murray@gmail.com'
|
|
||||||
WHEN 98 THEN 'malik.freeman@gmail.com'
|
|
||||||
WHEN 99 THEN 'esme.wells@gmail.com'
|
|
||||||
WHEN 100 THEN 'holden.webb@gmail.com'
|
|
||||||
ELSE email
|
|
||||||
END,
|
|
||||||
firstName = CASE id
|
|
||||||
WHEN 15 THEN 'Test'
|
|
||||||
WHEN 16 THEN 'Maya'
|
|
||||||
WHEN 17 THEN 'Noah'
|
|
||||||
WHEN 18 THEN 'Avery'
|
|
||||||
WHEN 19 THEN 'Leah'
|
|
||||||
WHEN 20 THEN 'Julian'
|
|
||||||
WHEN 21 THEN 'Zoe'
|
|
||||||
WHEN 22 THEN 'Ethan'
|
|
||||||
WHEN 23 THEN 'Ruby'
|
|
||||||
WHEN 24 THEN 'Caleb'
|
|
||||||
WHEN 25 THEN 'Ivy'
|
|
||||||
WHEN 26 THEN 'Isaac'
|
|
||||||
WHEN 27 THEN 'Hannah'
|
|
||||||
WHEN 28 THEN 'Mason'
|
|
||||||
WHEN 29 THEN 'Aria'
|
|
||||||
WHEN 30 THEN 'Wyatt'
|
|
||||||
WHEN 31 THEN 'Elena'
|
|
||||||
WHEN 32 THEN 'Leo'
|
|
||||||
WHEN 33 THEN 'Grace'
|
|
||||||
WHEN 34 THEN 'Hudson'
|
|
||||||
WHEN 35 THEN 'Claire'
|
|
||||||
WHEN 36 THEN 'Omar'
|
|
||||||
WHEN 37 THEN 'Naomi'
|
|
||||||
WHEN 38 THEN 'Jasper'
|
|
||||||
WHEN 39 THEN 'Sofia'
|
|
||||||
WHEN 40 THEN 'Miles'
|
|
||||||
WHEN 41 THEN 'Audrey'
|
|
||||||
WHEN 42 THEN 'Nathan'
|
|
||||||
WHEN 43 THEN 'Jade'
|
|
||||||
WHEN 44 THEN 'Rowan'
|
|
||||||
WHEN 45 THEN 'Lila'
|
|
||||||
WHEN 46 THEN 'Eli'
|
|
||||||
WHEN 47 THEN 'Violet'
|
|
||||||
WHEN 48 THEN 'Gavin'
|
|
||||||
WHEN 49 THEN 'Stella'
|
|
||||||
WHEN 50 THEN 'Adrian'
|
|
||||||
WHEN 51 THEN 'Hazel'
|
|
||||||
WHEN 52 THEN 'Connor'
|
|
||||||
WHEN 53 THEN 'Sadie'
|
|
||||||
WHEN 54 THEN 'Xavier'
|
|
||||||
WHEN 55 THEN 'Alice'
|
|
||||||
WHEN 56 THEN 'Roman'
|
|
||||||
WHEN 57 THEN 'Lucy'
|
|
||||||
WHEN 58 THEN 'Evan'
|
|
||||||
WHEN 59 THEN 'Mila'
|
|
||||||
WHEN 60 THEN 'Cole'
|
|
||||||
WHEN 61 THEN 'Nora'
|
|
||||||
WHEN 62 THEN 'Adam'
|
|
||||||
WHEN 63 THEN 'Layla'
|
|
||||||
WHEN 64 THEN 'Blake'
|
|
||||||
WHEN 65 THEN 'Ellie'
|
|
||||||
WHEN 66 THEN 'Ryan'
|
|
||||||
WHEN 67 THEN 'Cora'
|
|
||||||
WHEN 68 THEN 'Simon'
|
|
||||||
WHEN 69 THEN 'Piper'
|
|
||||||
WHEN 70 THEN 'Joel'
|
|
||||||
WHEN 71 THEN 'Eva'
|
|
||||||
WHEN 72 THEN 'Felix'
|
|
||||||
WHEN 73 THEN 'Maeve'
|
|
||||||
WHEN 74 THEN 'Tristan'
|
|
||||||
WHEN 75 THEN 'Ariana'
|
|
||||||
WHEN 76 THEN 'Declan'
|
|
||||||
WHEN 77 THEN 'Brooke'
|
|
||||||
WHEN 78 THEN 'Micah'
|
|
||||||
WHEN 79 THEN 'Bianca'
|
|
||||||
WHEN 80 THEN 'Jonah'
|
|
||||||
WHEN 81 THEN 'Tessa'
|
|
||||||
WHEN 82 THEN 'Damian'
|
|
||||||
WHEN 83 THEN 'Riley'
|
|
||||||
WHEN 84 THEN 'Kieran'
|
|
||||||
WHEN 85 THEN 'Sienna'
|
|
||||||
WHEN 86 THEN 'Finley'
|
|
||||||
WHEN 87 THEN 'Maren'
|
|
||||||
WHEN 88 THEN 'Asher'
|
|
||||||
WHEN 89 THEN 'Daphne'
|
|
||||||
WHEN 90 THEN 'Bennett'
|
|
||||||
WHEN 91 THEN 'Selena'
|
|
||||||
WHEN 92 THEN 'Emmett'
|
|
||||||
WHEN 93 THEN 'Phoebe'
|
|
||||||
WHEN 94 THEN 'Sawyer'
|
|
||||||
WHEN 95 THEN 'Keira'
|
|
||||||
WHEN 96 THEN 'Landon'
|
|
||||||
WHEN 97 THEN 'Rosalie'
|
|
||||||
WHEN 98 THEN 'Malik'
|
|
||||||
WHEN 99 THEN 'Esme'
|
|
||||||
WHEN 100 THEN 'Holden'
|
|
||||||
ELSE firstName
|
|
||||||
END,
|
|
||||||
fullName = CASE id
|
|
||||||
WHEN 15 THEN 'Test Customer'
|
|
||||||
WHEN 16 THEN 'Maya Brown'
|
|
||||||
WHEN 17 THEN 'Noah Clark'
|
|
||||||
WHEN 18 THEN 'Avery Wilson'
|
|
||||||
WHEN 19 THEN 'Leah Martinez'
|
|
||||||
WHEN 20 THEN 'Julian Anderson'
|
|
||||||
WHEN 21 THEN 'Zoe Taylor'
|
|
||||||
WHEN 22 THEN 'Ethan Parker'
|
|
||||||
WHEN 23 THEN 'Ruby Evans'
|
|
||||||
WHEN 24 THEN 'Caleb Scott'
|
|
||||||
WHEN 25 THEN 'Ivy Adams'
|
|
||||||
WHEN 26 THEN 'Isaac Baker'
|
|
||||||
WHEN 27 THEN 'Hannah Hall'
|
|
||||||
WHEN 28 THEN 'Mason Rivera'
|
|
||||||
WHEN 29 THEN 'Aria Mitchell'
|
|
||||||
WHEN 30 THEN 'Wyatt Collins'
|
|
||||||
WHEN 31 THEN 'Elena Morris'
|
|
||||||
WHEN 32 THEN 'Leo Cook'
|
|
||||||
WHEN 33 THEN 'Grace Bell'
|
|
||||||
WHEN 34 THEN 'Hudson Reed'
|
|
||||||
WHEN 35 THEN 'Claire Murphy'
|
|
||||||
WHEN 36 THEN 'Omar Bailey'
|
|
||||||
WHEN 37 THEN 'Naomi Cooper'
|
|
||||||
WHEN 38 THEN 'Jasper Richardson'
|
|
||||||
WHEN 39 THEN 'Sofia Cox'
|
|
||||||
WHEN 40 THEN 'Miles Howard'
|
|
||||||
WHEN 41 THEN 'Audrey Ward'
|
|
||||||
WHEN 42 THEN 'Nathan Torres'
|
|
||||||
WHEN 43 THEN 'Jade Peterson'
|
|
||||||
WHEN 44 THEN 'Rowan Gray'
|
|
||||||
WHEN 45 THEN 'Lila Ramirez'
|
|
||||||
WHEN 46 THEN 'Eli James'
|
|
||||||
WHEN 47 THEN 'Violet Watson'
|
|
||||||
WHEN 48 THEN 'Gavin Brooks'
|
|
||||||
WHEN 49 THEN 'Stella Kelly'
|
|
||||||
WHEN 50 THEN 'Adrian Sanders'
|
|
||||||
WHEN 51 THEN 'Hazel Price'
|
|
||||||
WHEN 52 THEN 'Connor Bennett'
|
|
||||||
WHEN 53 THEN 'Sadie Wood'
|
|
||||||
WHEN 54 THEN 'Xavier Barnes'
|
|
||||||
WHEN 55 THEN 'Alice Ross'
|
|
||||||
WHEN 56 THEN 'Roman Henderson'
|
|
||||||
WHEN 57 THEN 'Lucy Coleman'
|
|
||||||
WHEN 58 THEN 'Evan Jenkins'
|
|
||||||
WHEN 59 THEN 'Mila Perry'
|
|
||||||
WHEN 60 THEN 'Cole Powell'
|
|
||||||
WHEN 61 THEN 'Nora Long'
|
|
||||||
WHEN 62 THEN 'Adam Patterson'
|
|
||||||
WHEN 63 THEN 'Layla Hughes'
|
|
||||||
WHEN 64 THEN 'Blake Flores'
|
|
||||||
WHEN 65 THEN 'Ellie Washington'
|
|
||||||
WHEN 66 THEN 'Ryan Butler'
|
|
||||||
WHEN 67 THEN 'Cora Simmons'
|
|
||||||
WHEN 68 THEN 'Simon Foster'
|
|
||||||
WHEN 69 THEN 'Piper Gonzales'
|
|
||||||
WHEN 70 THEN 'Joel Bryant'
|
|
||||||
WHEN 71 THEN 'Eva Alexander'
|
|
||||||
WHEN 72 THEN 'Felix Russell'
|
|
||||||
WHEN 73 THEN 'Maeve Griffin'
|
|
||||||
WHEN 74 THEN 'Tristan Diaz'
|
|
||||||
WHEN 75 THEN 'Ariana Hayes'
|
|
||||||
WHEN 76 THEN 'Declan Myers'
|
|
||||||
WHEN 77 THEN 'Brooke Ford'
|
|
||||||
WHEN 78 THEN 'Micah Hamilton'
|
|
||||||
WHEN 79 THEN 'Bianca Graham'
|
|
||||||
WHEN 80 THEN 'Jonah Sullivan'
|
|
||||||
WHEN 81 THEN 'Tessa Wallace'
|
|
||||||
WHEN 82 THEN 'Damian Woods'
|
|
||||||
WHEN 83 THEN 'Riley Cole'
|
|
||||||
WHEN 84 THEN 'Kieran West'
|
|
||||||
WHEN 85 THEN 'Sienna Jordan'
|
|
||||||
WHEN 86 THEN 'Finley Owens'
|
|
||||||
WHEN 87 THEN 'Maren Reynolds'
|
|
||||||
WHEN 88 THEN 'Asher Fisher'
|
|
||||||
WHEN 89 THEN 'Daphne Ellis'
|
|
||||||
WHEN 90 THEN 'Bennett Harrison'
|
|
||||||
WHEN 91 THEN 'Selena Gibson'
|
|
||||||
WHEN 92 THEN 'Emmett Mcdonald'
|
|
||||||
WHEN 93 THEN 'Phoebe Cruz'
|
|
||||||
WHEN 94 THEN 'Sawyer Marshall'
|
|
||||||
WHEN 95 THEN 'Keira Ortiz'
|
|
||||||
WHEN 96 THEN 'Landon Gomez'
|
|
||||||
WHEN 97 THEN 'Rosalie Murray'
|
|
||||||
WHEN 98 THEN 'Malik Freeman'
|
|
||||||
WHEN 99 THEN 'Esme Wells'
|
|
||||||
WHEN 100 THEN 'Holden Webb'
|
|
||||||
ELSE fullName
|
|
||||||
END,
|
|
||||||
primaryStoreId = CASE id
|
|
||||||
WHEN 15 THEN 1
|
|
||||||
WHEN 16 THEN 2
|
|
||||||
WHEN 17 THEN 3
|
|
||||||
WHEN 18 THEN 1
|
|
||||||
WHEN 19 THEN 2
|
|
||||||
WHEN 20 THEN 3
|
|
||||||
WHEN 21 THEN 1
|
|
||||||
WHEN 22 THEN 2
|
|
||||||
WHEN 23 THEN 3
|
|
||||||
WHEN 24 THEN 1
|
|
||||||
WHEN 25 THEN 2
|
|
||||||
WHEN 26 THEN 3
|
|
||||||
WHEN 27 THEN 1
|
|
||||||
WHEN 28 THEN 2
|
|
||||||
WHEN 29 THEN 3
|
|
||||||
WHEN 30 THEN 1
|
|
||||||
WHEN 31 THEN 2
|
|
||||||
WHEN 32 THEN 3
|
|
||||||
WHEN 33 THEN 1
|
|
||||||
WHEN 34 THEN 2
|
|
||||||
WHEN 35 THEN 3
|
|
||||||
WHEN 36 THEN 1
|
|
||||||
WHEN 37 THEN 2
|
|
||||||
WHEN 38 THEN 3
|
|
||||||
WHEN 39 THEN 1
|
|
||||||
WHEN 40 THEN 2
|
|
||||||
WHEN 41 THEN 3
|
|
||||||
WHEN 42 THEN 1
|
|
||||||
WHEN 43 THEN 2
|
|
||||||
WHEN 44 THEN 3
|
|
||||||
WHEN 45 THEN 1
|
|
||||||
WHEN 46 THEN 2
|
|
||||||
WHEN 47 THEN 3
|
|
||||||
WHEN 48 THEN 1
|
|
||||||
WHEN 49 THEN 2
|
|
||||||
WHEN 50 THEN 3
|
|
||||||
WHEN 51 THEN 1
|
|
||||||
WHEN 52 THEN 2
|
|
||||||
WHEN 53 THEN 3
|
|
||||||
WHEN 54 THEN 1
|
|
||||||
WHEN 55 THEN 2
|
|
||||||
WHEN 56 THEN 3
|
|
||||||
WHEN 57 THEN 1
|
|
||||||
WHEN 58 THEN 2
|
|
||||||
WHEN 59 THEN 3
|
|
||||||
WHEN 60 THEN 1
|
|
||||||
WHEN 61 THEN 2
|
|
||||||
WHEN 62 THEN 3
|
|
||||||
WHEN 63 THEN 1
|
|
||||||
WHEN 64 THEN 2
|
|
||||||
WHEN 65 THEN 3
|
|
||||||
WHEN 66 THEN 1
|
|
||||||
WHEN 67 THEN 2
|
|
||||||
WHEN 68 THEN 3
|
|
||||||
WHEN 69 THEN 1
|
|
||||||
WHEN 70 THEN 2
|
|
||||||
WHEN 71 THEN 3
|
|
||||||
WHEN 72 THEN 1
|
|
||||||
WHEN 73 THEN 2
|
|
||||||
WHEN 74 THEN 3
|
|
||||||
WHEN 75 THEN 1
|
|
||||||
WHEN 76 THEN 2
|
|
||||||
WHEN 77 THEN 3
|
|
||||||
WHEN 78 THEN 1
|
|
||||||
WHEN 79 THEN 2
|
|
||||||
WHEN 80 THEN 3
|
|
||||||
WHEN 81 THEN 1
|
|
||||||
WHEN 82 THEN 2
|
|
||||||
WHEN 83 THEN 3
|
|
||||||
WHEN 84 THEN 1
|
|
||||||
WHEN 85 THEN 2
|
|
||||||
WHEN 86 THEN 3
|
|
||||||
WHEN 87 THEN 1
|
|
||||||
WHEN 88 THEN 2
|
|
||||||
WHEN 89 THEN 3
|
|
||||||
WHEN 90 THEN 1
|
|
||||||
WHEN 91 THEN 2
|
|
||||||
WHEN 92 THEN 3
|
|
||||||
WHEN 93 THEN 1
|
|
||||||
WHEN 94 THEN 2
|
|
||||||
WHEN 95 THEN 3
|
|
||||||
WHEN 96 THEN 1
|
|
||||||
WHEN 97 THEN 2
|
|
||||||
WHEN 98 THEN 3
|
|
||||||
WHEN 99 THEN 1
|
|
||||||
WHEN 100 THEN 2
|
|
||||||
ELSE primaryStoreId
|
|
||||||
END
|
|
||||||
WHERE id BETWEEN 15 AND 100;
|
|
||||||
|
|
||||||
UPDATE users
|
|
||||||
SET fullName = TRIM(CONCAT_WS(' ', firstName, lastName))
|
|
||||||
WHERE (fullName IS NULL OR fullName = '')
|
|
||||||
AND ((firstName IS NOT NULL AND firstName <> '') OR (lastName IS NOT NULL AND lastName <> ''));
|
|
||||||
|
|
||||||
UPDATE activityLog al
|
|
||||||
LEFT JOIN users u ON u.id = al.userId
|
|
||||||
LEFT JOIN storeLocation s ON s.storeId = al.storeId
|
|
||||||
SET al.usernameSnapshot = COALESCE(al.usernameSnapshot, u.username),
|
|
||||||
al.fullNameSnapshot = COALESCE(al.fullNameSnapshot, COALESCE(NULLIF(u.fullName, ''), TRIM(CONCAT_WS(' ', u.firstName, u.lastName)))),
|
|
||||||
al.roleSnapshot = COALESCE(al.roleSnapshot, u.role),
|
|
||||||
al.storeNameSnapshot = COALESCE(al.storeNameSnapshot, s.storeName)
|
|
||||||
WHERE al.usernameSnapshot IS NULL
|
|
||||||
OR al.fullNameSnapshot IS NULL
|
|
||||||
OR al.roleSnapshot IS NULL
|
|
||||||
OR (al.storeId IS NOT NULL AND al.storeNameSnapshot IS NULL);
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
UPDATE users
|
|
||||||
SET avatarUrl = REPLACE(avatarUrl, 'https://images.petshop.local/users/', '/uploads/avatars/')
|
|
||||||
WHERE avatarUrl LIKE 'https://images.petshop.local/users/%';
|
|
||||||
|
|
||||||
UPDATE pet
|
|
||||||
SET imageUrl = REPLACE(imageUrl, 'https://images.petshop.local/pets/', '/uploads/pets/')
|
|
||||||
WHERE imageUrl LIKE 'https://images.petshop.local/pets/%';
|
|
||||||
|
|
||||||
UPDATE product
|
|
||||||
SET imageUrl = REPLACE(imageUrl, 'https://images.petshop.local/products/', '/uploads/products/')
|
|
||||||
WHERE imageUrl LIKE 'https://images.petshop.local/products/%';
|
|
||||||
Reference in New Issue
Block a user