Skip to content

Commit

Permalink
Modificada: Tabla products_has_shopping_list
Browse files Browse the repository at this point in the history
- Agregadas columnas "created_at" y "updated_at".
- Se agrega las columnas a la entidad en java.
  • Loading branch information
nmarulo committed Nov 10, 2024
1 parent fb035c8 commit 287dd07
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@
import dev.nmarulo.depensaapp.app.shoppinglist.ShoppingList;
import dev.nmarulo.depensaapp.app.unitytypes.UnitType;
import dev.nmarulo.depensaapp.commons.gson.GsonExclude;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import jakarta.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "products_has_shopping_list")
@ToString
public class ProductHasShoppingList {
Expand All @@ -37,6 +42,16 @@ public class ProductHasShoppingList {
@Column(name = "selected", nullable = false)
private boolean selected;

@Basic
@CreatedDate
@Column(name = "created_at", updatable = false)
private LocalDateTime createdAt;

@Basic
@LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "product_id", insertable = false, updatable = false)
@ToString.Exclude
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE products_has_shopping_list
ADD created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;

ALTER TABLE products_has_shopping_list
ADD updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;

0 comments on commit 287dd07

Please sign in to comment.