Skip to content

Commit

Permalink
add generated by script column
Browse files Browse the repository at this point in the history
  • Loading branch information
auumgn committed Dec 16, 2024
1 parent 653cb2f commit d1d69ee
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ public class ProfileEmailDomain {

private Date lastModified;

private Boolean generatedByScript;

public static ProfileEmailDomain valueOf(ProfileEmailDomainEntity ed) {
ProfileEmailDomain emailDomain = new ProfileEmailDomain();

if (ed != null) {
emailDomain.setValue(ed.getEmailDomain());
emailDomain.setVisibility(ed.getVisibility());
emailDomain.setGeneratedByScript(ed.getGeneratedByScript());

if (ed.getDateCreated() != null) {
Date createdDate = new Date();
Expand Down Expand Up @@ -77,4 +80,8 @@ public Date getLastModified() {
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}

public Boolean getGeneratedByScript() { return generatedByScript; }

public void setGeneratedByScript(Boolean generatedByScript) { this.generatedByScript = generatedByScript; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ProfileEmailDomainEntity extends BaseEntity<Long> {
private String emailDomain;
private String visibility;
private Date dateCreated;
private Boolean generatedByScript;

@Id
@Column(name = "id")
Expand Down Expand Up @@ -67,6 +68,15 @@ public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}

@Column(name = "generated_by_script")
public Boolean getGeneratedByScript() {
return generatedByScript;
}

public void setGeneratedByScript(Boolean generatedByScript) {
this.generatedByScript = generatedByScript;
}


@Override
public boolean equals(Object obj) {
Expand Down
1 change: 1 addition & 0 deletions orcid-persistence/src/main/resources/db-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
<include file="/db/updates/init_display_index_on_affiliations.xml" />
<include file="/db/updates/use_email_hash_as_email_primary_key.xml" />
<include file="/db/updates/add_record_locked_date_admin_id.xml" />
<include file="/db/updates/add_generated_by_script_column_to_profile_email_domain.xml" />

<!--
Please leave the following script commented out as it breaks unit tests using hsqldb. it is still
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<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-2.0.xsd">

<changeSet author="Andrej Romanov" id="ADD-GENERATED-BY-SCRIPT-TO-PROFILE-EMAIL-DOMAIN-TABLE">
<addColumn tableName="profile_email_domain">
<column name="generated_by_script" type="BOOLEAN" defaultValue="false"/>
</addColumn>
</changeSet>

<changeSet author="Andrej Romanov" id="UPDATE-GENERATED-BY-SCRIPT-BASED-ON-CREATED-DATE">
<update tableName="profile_email_domain">
<column name="generated_by_script" value="true"/>
<where>date_created &lt; '2024-10-28'</where>
</update>
</changeSet>
</databaseChangeLog>

0 comments on commit d1d69ee

Please sign in to comment.