diff --git a/model/jpa/src/main/resources/META-INF/jpa-changelog-3.2.0.xml b/model/jpa/src/main/resources/META-INF/jpa-changelog-3.2.0.xml
index daa1c50..692301f 100644
--- a/model/jpa/src/main/resources/META-INF/jpa-changelog-3.2.0.xml
+++ b/model/jpa/src/main/resources/META-INF/jpa-changelog-3.2.0.xml
@@ -16,7 +16,29 @@
~ limitations under the License.
-->
<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-3.1.xsd">
- <changeSet author="keycloak" id="3.2.0">
+
+ <!--
+ NOTE that there was an older version of this file containing a bug.
+ The first changeset fixes this bug for those who were able to
+ lucky enough to apply it.
+ The second changeset is the fixed original changeset.
+ -->
+
+ <changeSet author="keycloak" id="3.2.0-fix">
+ <preConditions onFail="MARK_RAN">
+ <changeSetExecuted id="3.2.0" author="keycloak" changeLogFile="META-INF/jpa-changelog-3.2.0.xml"/>
+ </preConditions>
+
+ <addNotNullConstraint tableName="CLIENT_INITIAL_ACCESS" columnName="REALM_ID" columnDataType="VARCHAR(36)" />
+ </changeSet>
+
+ <changeSet author="keycloak" id="3.2.0-fixed">
+ <preConditions onFail="MARK_RAN">
+ <not>
+ <changeSetExecuted id="3.2.0" author="keycloak" changeLogFile="META-INF/jpa-changelog-3.2.0.xml"/>
+ </not>
+ </preConditions>
+
<addColumn tableName="REALM">
<column name="DOCKER_AUTH_FLOW" type="VARCHAR(36)">
<constraints nullable="true"/>
@@ -31,7 +53,9 @@
<column name="ID" type="VARCHAR(36)">
<constraints nullable="false"/>
</column>
- <column name="REALM_ID" type="VARCHAR(36)"/>
+ <column name="REALM_ID" type="VARCHAR(36)">
+ <constraints nullable="false"/>
+ </column>
<column name="TIMESTAMP" type="INT"/>
<column name="EXPIRATION" type="INT"/>