Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generated by script column #7153

Merged
merged 7 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -407,4 +407,5 @@
<include file="/db/updates/add_date_verified_to_email.xml" />
<include file="/db/updates/create_public_api_daily_rate_limit.xml" />
<include file="/db/updates/add_public_api_daily_rate_limit_indexes.xml" />
<include file="/db/updates/add_generated_by_script_column_to_profile_email_domain.xml" />
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<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">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="profile_email_domain" columnName="generated_by_script"/>
</not>
</preConditions>
<sql>ALTER TABLE profile_email_domain ADD generated_by_script boolean default false;</sql>
</changeSet>

<changeSet author="Andrej Romanov" id="UPDATE-GENERATED-BY-SCRIPT-BASED-ON-CREATED-DATE" dbms="postgresql">
<sql>
UPDATE profile_email_domain SET generated_by_script = true WHERE date_created &lt; '2024-10-28';
</sql>
</changeSet>
</databaseChangeLog>
Loading