Skip to content

Commit

Permalink
1070 - Add audit columns to the project_workflow table
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicac committed Nov 12, 2024
1 parent 14460fd commit 4677df0
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@

package com.bytechef.automation.configuration.domain;

import java.time.LocalDateTime;
import java.util.Objects;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.annotation.Version;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

Expand All @@ -42,6 +48,25 @@ public final class ProjectWorkflow {
@Column("workflow_reference_code")
private String workflowReferenceCode;

@CreatedBy
@Column("created_by")
private String createdBy;

@Column("created_date")
@CreatedDate
private LocalDateTime createdDate;

@Column("last_modified_by")
@LastModifiedBy
private String lastModifiedBy;

@Column("last_modified_date")
@LastModifiedDate
private LocalDateTime lastModifiedDate;

@Version
private int version;

public ProjectWorkflow() {
}

Expand Down Expand Up @@ -96,6 +121,26 @@ public String getWorkflowReferenceCode() {
return workflowReferenceCode;
}

public String getCreatedBy() {
return createdBy;
}

public LocalDateTime getCreatedDate() {
return createdDate;
}

public String getLastModifiedBy() {
return lastModifiedBy;
}

public LocalDateTime getLastModifiedDate() {
return lastModifiedDate;
}

public int getVersion() {
return version;
}

public void setProjectVersion(int projectVersion) {
this.projectVersion = projectVersion;
}
Expand All @@ -108,6 +153,10 @@ public void setWorkflowReferenceCode(String workflowReferenceCode) {
this.workflowReferenceCode = workflowReferenceCode;
}

public void setVersion(int version) {
this.version = version;
}

@Override
public String toString() {
return "ProjectWorkflow{" +
Expand All @@ -116,6 +165,11 @@ public String toString() {
", projectVersion=" + projectVersion +
", workflowId='" + workflowId + '\'' +
", workflowReferenceCode='" + workflowReferenceCode + '\'' +
", createdBy='" + createdBy + '\'' +
", createdDate=" + createdDate +
", lastModifiedBy='" + lastModifiedBy + '\'' +
", lastModifiedDate=" + lastModifiedDate +
", version=" + version +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">
<changeSet id="20240604153061" author="Ivica Cardic">
<addColumn tableName="project_workflow">
<column name="created_by" type="VARCHAR(256)" defaultValue="system">
<constraints nullable="false" />
</column>
<column name="created_date" type="TIMESTAMP" defaultValue="now">
<constraints nullable="false" />
</column>
<column name="last_modified_by" type="VARCHAR(256)" defaultValue="system">
<constraints nullable="false" />
</column>
<column name="last_modified_date" type="TIMESTAMP" defaultValue="now">
<constraints nullable="false" />
</column>
<column name="version" type="BIGINT" defaultValue="1">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">
<changeSet id="20240604153071" author="Ivica Cardic">
<dropDefaultValue tableName="project_workflow" columnName="created_by" />
<dropDefaultValue tableName="project_workflow" columnName="created_date" />
<dropDefaultValue tableName="project_workflow" columnName="last_modified_by" />
<dropDefaultValue tableName="project_workflow" columnName="last_modified_date" />
<dropDefaultValue tableName="project_workflow" columnName="version" />
</changeSet>
</databaseChangeLog>

0 comments on commit 4677df0

Please sign in to comment.