Skip to content

Commit

Permalink
520 - Add audit columns to the integration_workflow table
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicac committed Nov 12, 2024
1 parent 4677df0 commit ede578a
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.embedded.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 IntegrationWorkflow {
@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 IntegrationWorkflow() {
}

Expand Down Expand Up @@ -97,6 +122,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 setIntegrationVersion(int integrationVersion) {
this.integrationVersion = integrationVersion;
}
Expand All @@ -109,6 +154,10 @@ public void setWorkflowReferenceCode(String workflowReferenceCode) {
this.workflowReferenceCode = workflowReferenceCode;
}

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

@Override
public String toString() {
return "IntegrationWorkflow{" +
Expand All @@ -117,6 +166,11 @@ public String toString() {
", integrationVersion=" + integrationVersion +
", 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="20240604183100" author="Ivica Cardic">
<addColumn tableName="integration_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="20240604183110" author="Ivica Cardic">
<dropDefaultValue tableName="integration_workflow" columnName="created_by" />
<dropDefaultValue tableName="integration_workflow" columnName="created_date" />
<dropDefaultValue tableName="integration_workflow" columnName="last_modified_by" />
<dropDefaultValue tableName="integration_workflow" columnName="last_modified_date" />
<dropDefaultValue tableName="integration_workflow" columnName="version" />
</changeSet>
</databaseChangeLog>

0 comments on commit ede578a

Please sign in to comment.