I'm implementing the Keycloak organization for our project. Our project uses mssql and this seems create an error. When I build a docker image based on quay.io/phasetwo/phasetwo-keycloak:latest and run it I get the following error:
Reason: liquibase.exception.DatabaseException: Column 'ORGANIZATION_ROLE.ID' is not the same length or scale as referencing column 'USER_ORGANIZATION_ROLE_MAPPING.ROLE_ID' in foreign key 'FK_123g9nf5findslfksadifu277'. Columns participating in a foreign key relationship must be defined with the same length and scale. [Failed SQL: (1753) ALTER TABLE USER_ORGANIZATION_ROLE_MAPPING ADD CONSTRAINT FK_123g9nf5findslfksadifu277 FOREIGN KEY (ROLE_ID) REFERENCES ORGANIZATION_ROLE (ID)]
It seems that the USER_ORGANIZATION_ROLE_MAPPING.ROLE_ID has a length of 255 and ORGANIZATION_ROLE.ID has a length of 36.
Hello,
I'm implementing the Keycloak organization for our project. Our project uses mssql and this seems create an error. When I build a docker image based on quay.io/phasetwo/phasetwo-keycloak:latest and run it I get the following error:
Reason: liquibase.exception.DatabaseException: Column 'ORGANIZATION_ROLE.ID' is not the same length or scale as referencing column 'USER_ORGANIZATION_ROLE_MAPPING.ROLE_ID' in foreign key 'FK_123g9nf5findslfksadifu277'. Columns participating in a foreign key relationship must be defined with the same length and scale. [Failed SQL: (1753) ALTER TABLE USER_ORGANIZATION_ROLE_MAPPING ADD CONSTRAINT FK_123g9nf5findslfksadifu277 FOREIGN KEY (ROLE_ID) REFERENCES ORGANIZATION_ROLE (ID)]
It seems that the USER_ORGANIZATION_ROLE_MAPPING.ROLE_ID has a length of 255 and ORGANIZATION_ROLE.ID has a length of 36.
See: https://github.com/p2-inc/keycloak-orgs/blob/e61c9c0a5119d5e731b78509ad7abdeecc544dbb/src/main/resources/META-INF/jpa-changelog-phasetwo-20200424.xml#L5
@Column(name = "ID", length = 36): https://github.com/p2-inc/keycloak-orgs/blob/e61c9c0a5119d5e731b78509ad7abdeecc544dbb/src/main/java/io/phasetwo/service/model/jpa/entity/OrganizationRoleEntity.java#L31
@JoinColumn(name = "ROLE_ID") -> no length which I guess results in a default 255: https://github.com/p2-inc/keycloak-orgs/blob/e61c9c0a5119d5e731b78509ad7abdeecc544dbb/src/main/java/io/phasetwo/service/model/jpa/entity/UserOrganizationRoleMappingEntity.java#L64
Could the length of the USER_ORGANIZATION_ROLE_MAPPING.ROLE_ID be changed to 36?
Thanks!