forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jpa-changelog-13.0.0.xml
100 lines (87 loc) · 5.18 KB
/
jpa-changelog-13.0.0.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
~ * Copyright 2020 Red Hat, Inc. and/or its affiliates
~ * and other contributors as indicated by the @author tags.
~ *
~ * Licensed under the Apache License, Version 2.0 (the "License");
~ * you may not use this file except in compliance with the License.
~ * You may obtain a copy of the License at
~ *
~ * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ * Unless required by applicable law or agreed to in writing, software
~ * distributed under the License is distributed on an "AS IS" BASIS,
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ * See the License for the specific language governing permissions and
~ * 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="default-roles">
<addColumn tableName="REALM">
<column name="DEFAULT_ROLE" type="VARCHAR(255)"/>
</addColumn>
<customChange class="org.keycloak.connections.jpa.updater.liquibase.custom.JpaUpdate13_0_0_MigrateDefaultRoles" />
</changeSet>
<changeSet author="keycloak" id="default-roles-cleanup">
<dropTable tableName="REALM_DEFAULT_ROLES" />
<dropTable tableName="CLIENT_DEFAULT_ROLES" />
</changeSet>
<changeSet author="keycloak" id="13.0.0-KEYCLOAK-16844">
<createIndex tableName="OFFLINE_USER_SESSION" indexName="IDX_OFFLINE_USS_PRELOAD">
<column name="OFFLINE_FLAG" type="VARCHAR(4)"/>
<column name="CREATED_ON" type="INT"/>
<column name="USER_SESSION_ID" type="VARCHAR(36)"/>
</createIndex>
</changeSet>
<changeSet author="keycloak" id="map-remove-ri-13.0.0">
<dropForeignKeyConstraint baseTableName="DEFAULT_CLIENT_SCOPE" constraintName="FK_R_DEF_CLI_SCOPE_SCOPE"/>
<dropForeignKeyConstraint baseTableName="CLIENT_SCOPE_CLIENT" constraintName="FK_C_CLI_SCOPE_SCOPE"/>
<dropForeignKeyConstraint baseTableName="CLIENT_SCOPE_CLIENT" constraintName="FK_C_CLI_SCOPE_CLIENT"/>
<dropForeignKeyConstraint baseTableName="CLIENT" constraintName="FK_P56CTINXXB9GSK57FO49F9TAC"/>
<dropForeignKeyConstraint baseTableName="CLIENT_SCOPE" constraintName="FK_REALM_CLI_SCOPE"/>
<dropForeignKeyConstraint baseTableName="KEYCLOAK_GROUP" constraintName="FK_GROUP_REALM"/>
</changeSet>
<changeSet author="keycloak" id="13.0.0-KEYCLOAK-17992-drop-constraints">
<preConditions onFail="MARK_RAN" onSqlOutput="TEST">
<!-- sql server needs drop and re-create constraints before modifying data type -->
<dbms type="mssql"/>
</preConditions>
<dropPrimaryKey tableName="CLIENT_SCOPE_CLIENT" constraintName="C_CLI_SCOPE_BIND"/>
<dropIndex tableName="CLIENT_SCOPE_CLIENT" indexName="IDX_CLSCOPE_CL"/>
<dropIndex tableName="CLIENT_SCOPE_CLIENT" indexName="IDX_CL_CLSCOPE"/>
</changeSet>
<changeSet author="keycloak" id="13.0.0-increase-column-size-federated">
<modifyDataType newDataType="VARCHAR(255)" tableName="CLIENT_SCOPE_CLIENT" columnName="CLIENT_ID"/>
<modifyDataType newDataType="VARCHAR(255)" tableName="CLIENT_SCOPE_CLIENT" columnName="SCOPE_ID"/>
</changeSet>
<changeSet author="keycloak" id="13.0.0-KEYCLOAK-17992-recreate-constraints">
<preConditions onFail="MARK_RAN" onSqlOutput="TEST">
<!-- sql server needs drop and re-create constraints before modifying data type -->
<dbms type="mssql"/>
</preConditions>
<addNotNullConstraint tableName="CLIENT_SCOPE_CLIENT" columnName="CLIENT_ID" columnDataType="VARCHAR(255)"/>
<addNotNullConstraint tableName="CLIENT_SCOPE_CLIENT" columnName="SCOPE_ID" columnDataType="VARCHAR(255)"/>
<addPrimaryKey columnNames="CLIENT_ID, SCOPE_ID" constraintName="C_CLI_SCOPE_BIND" tableName="CLIENT_SCOPE_CLIENT"/>
<createIndex indexName="IDX_CLSCOPE_CL" tableName="CLIENT_SCOPE_CLIENT">
<column name="CLIENT_ID" type="VARCHAR(255)"/>
</createIndex>
<createIndex indexName="IDX_CL_CLSCOPE" tableName="CLIENT_SCOPE_CLIENT">
<column name="SCOPE_ID" type="VARCHAR(255)"/>
</createIndex>
</changeSet>
<changeSet author="keycloak" id="json-string-accomodation-fixed">
<preConditions onFail="MARK_RAN" onSqlOutput="TEST">
<not>
<changeSetExecuted id="json-string-accomodation" author="keycloak" changeLogFile="META-INF/jpa-changelog-13.0.0.xml"/>
</not>
</preConditions>
<addColumn tableName="REALM_ATTRIBUTE">
<column name="VALUE_NEW" type="NCLOB" />
</addColumn>
<update tableName="REALM_ATTRIBUTE">
<column name="VALUE_NEW" valueComputed="VALUE"/>
</update>
<dropColumn tableName="REALM_ATTRIBUTE" columnName="VALUE"/>
<renameColumn tableName="REALM_ATTRIBUTE" oldColumnName="VALUE_NEW" newColumnName="VALUE" columnDataType="NCLOB"/>
</changeSet>
</databaseChangeLog>