Skip to content

Commit

Permalink
SHIBUI-2273
Browse files Browse the repository at this point in the history
Setup liquidbase to run for SQL SERVER


Former-commit-id: c5f6475
  • Loading branch information
chasegawa committed Jun 14, 2022
1 parent 7265908 commit 94b4706
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class CustomEntityAttributeDefinition implements IRelyingPartyOverridePro
@ElementCollection
@CollectionTable(name = "custom_entity_attr_list_items", joinColumns = @JoinColumn(name = "name"))
@Fetch(FetchMode.JOIN)
@Column(name = "value", nullable = false)
@Column(name = "item_value", nullable = false)
Set<String> customAttrListDefinitions = new HashSet<>();

@Column(name = "default_value", nullable = true)
Expand Down Expand Up @@ -114,4 +114,4 @@ public void setName(String name) {
public void updateExamplesList() {
examples = customAttrListDefinitions;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.hibernate.envers.Audited;

import javax.annotation.Nullable;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

@MappedSuperclass
Expand All @@ -11,6 +12,7 @@ public class LocalizedName extends AbstractXMLObject implements org.opensaml.sam

private String xMLLang;

@Column(name = "name_value")
private String value;

@Nullable
Expand All @@ -34,4 +36,4 @@ public String getValue() {
public void setValue(@Nullable String value) {
this.value = value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class OrganizationURL extends AbstractXMLObject implements org.opensaml.s

private String xMLLang;

@Column(name="value")
@Column(name="uri_value")
private String uri;

@Nullable
Expand Down
3 changes: 2 additions & 1 deletion backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ spring.jackson.mapper.accept-case-insensitive-enums=true
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect

# Liquibase properties
spring.liquibase.enabled=false
spring.liquibase.enabled=true
spring.liquibase.change-log=db/changelog/changelog.sql

# Hibernate properties
# for production never ever use create, create-drop. It's BEST to use validate
Expand Down
29 changes: 29 additions & 0 deletions backend/src/main/resources/db/changelog/changelog.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- liquibase formatted sql

-- changeset liquibase:1.11.0 dbms:mariadb,mysql,postgresql
-- preconditions onFail:MARK_RAN
-- precondition-sql-check expectedResult:1 SELECT 1 FROM users
-- comment: /* we don't need to run this if the system is new */
ALTER TABLE resource_backed_metadata_resolver
RENAME file TO file_resource;
GO
ALTER TABLE organizationurl
RENAME 'value' TO 'uri_value';
GO

-- changeset liquibase:1.11.0 dbms:mssql
-- preconditions onFail:MARK_RAN
-- precondition-sql-check expectedResult:1 SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'users'
-- comment: /* we don't need to run this if the system is new */
EXEC sp_rename 'organizationurl.value', uri_value, 'COLUMN'
GO
EXEC sp_rename 'custom_entity_attr_list_items.value', item_value, 'COLUMN'
GO
EXEC sp_rename 'organization_name.value', name_value, 'COLUMN'
GO
EXEC sp_rename 'organization_display_name.value', name_value, 'COLUMN'
GO
EXEC sp_rename 'service_description.value', name_value, 'COLUMN'
GO
EXEC sp_rename 'service_name.value', name_value, 'COLUMN'
GO

0 comments on commit 94b4706

Please sign in to comment.