Skip to content

Commit

Permalink
#372 add soft delete to timereport using a new column deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausRicharz committed Jul 4, 2024
1 parent 9dc9b7e commit b750880
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/tb/dailyreport/domain/Timereport.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;
import org.hibernate.annotations.Where;
import org.tb.common.AuditedEntity;
import org.tb.common.util.DateUtils;
import org.tb.dailyreport.service.TimereportService;
import org.tb.employee.domain.Employeecontract;
import org.tb.order.domain.Employeeorder;
import org.tb.order.domain.Suborder;
Expand All @@ -24,6 +28,8 @@
@Setter
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SQLDelete(sql = "UPDATE timereport SET deleted = 1 WHERE id=? and updatecounter=?")
@SQLRestriction("deleted = 0")
public class Timereport extends AuditedEntity implements Serializable {

private static final long serialVersionUID = 1L;
Expand Down
18 changes: 18 additions & 0 deletions src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,24 @@ databaseChangeLog:
name: orderType
value: KRANK_URLAUB_ABWESEND
where: sign IN ('URLAUB','S-URLAUB','KRANK','ELTERNZEIT','MUTTERSCHUTZ','REISEZEIT')
- changeSet:
id: 24
author: kr
comment: Add delete column to timereport to introduce soft delete
preConditions:
- onFail: MARK_RAN
- not:
- columnExists:
tableName: timereport
columnName: deleted
changes:
- addColumn:
tableName: timereport
columns:
- column:
name: deleted
type: bit(1)
defaultValue: 0

# - include:
# file: db/changelog/includes/addAllEmployees.sql

0 comments on commit b750880

Please sign in to comment.