Add prefix "kc_" to all existing tables

Closes #10101
This commit is contained in:
vramik 2022-02-10 15:14:58 +01:00 committed by Hynek Mlnařík
parent 6c09ec6de6
commit 8a8d59a124
9 changed files with 30 additions and 30 deletions

View file

@ -21,7 +21,7 @@ import javax.persistence.Table;
import org.keycloak.models.map.storage.jpa.JpaAttributeEntity; import org.keycloak.models.map.storage.jpa.JpaAttributeEntity;
@Entity @Entity
@Table(name = "client_attribute") @Table(name = "kc_client_attribute")
public class JpaClientAttributeEntity extends JpaAttributeEntity<JpaClientEntity> { public class JpaClientAttributeEntity extends JpaAttributeEntity<JpaClientEntity> {
public JpaClientAttributeEntity() { public JpaClientAttributeEntity() {

View file

@ -53,7 +53,7 @@ import org.keycloak.models.map.storage.jpa.hibernate.jsonb.JsonbType;
* therefore marked as non-insertable and non-updatable to instruct hibernate. * therefore marked as non-insertable and non-updatable to instruct hibernate.
*/ */
@Entity @Entity
@Table(name = "client", @Table(name = "kc_client",
uniqueConstraints = { uniqueConstraints = {
@UniqueConstraint( @UniqueConstraint(
columnNames = {"realmId", "clientId"} columnNames = {"realmId", "clientId"}

View file

@ -21,7 +21,7 @@ import javax.persistence.Table;
import org.keycloak.models.map.storage.jpa.JpaAttributeEntity; import org.keycloak.models.map.storage.jpa.JpaAttributeEntity;
@Entity @Entity
@Table(name = "client_scope_attribute") @Table(name = "kc_client_scope_attribute")
public class JpaClientScopeAttributeEntity extends JpaAttributeEntity<JpaClientScopeEntity> { public class JpaClientScopeAttributeEntity extends JpaAttributeEntity<JpaClientScopeEntity> {
public JpaClientScopeAttributeEntity() { public JpaClientScopeAttributeEntity() {

View file

@ -53,7 +53,7 @@ import org.keycloak.models.map.storage.jpa.hibernate.jsonb.JsonbType;
* therefore marked as non-insertable and non-updatable to instruct hibernate. * therefore marked as non-insertable and non-updatable to instruct hibernate.
*/ */
@Entity @Entity
@Table(name = "client_scope", uniqueConstraints = {@UniqueConstraint(columnNames = {"realmId", "name"})}) @Table(name = "kc_client_scope", uniqueConstraints = {@UniqueConstraint(columnNames = {"realmId", "name"})})
@TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonbType.class)}) @TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonbType.class)})
public class JpaClientScopeEntity extends AbstractClientScopeEntity implements JpaRootEntity { public class JpaClientScopeEntity extends AbstractClientScopeEntity implements JpaRootEntity {

View file

@ -21,7 +21,7 @@ import javax.persistence.Table;
import org.keycloak.models.map.storage.jpa.JpaAttributeEntity; import org.keycloak.models.map.storage.jpa.JpaAttributeEntity;
@Entity @Entity
@Table(name = "role_attribute") @Table(name = "kc_role_attribute")
public class JpaRoleAttributeEntity extends JpaAttributeEntity<JpaRoleEntity> { public class JpaRoleAttributeEntity extends JpaAttributeEntity<JpaRoleEntity> {
public JpaRoleAttributeEntity() { public JpaRoleAttributeEntity() {

View file

@ -51,7 +51,7 @@ import org.keycloak.models.map.storage.jpa.hibernate.jsonb.JsonbType;
* therefore marked as non-insertable and non-updatable to instruct hibernate. * therefore marked as non-insertable and non-updatable to instruct hibernate.
*/ */
@Entity @Entity
@Table(name = "role", uniqueConstraints = {@UniqueConstraint(columnNames = {"realmId", "clientId", "name"})}) @Table(name = "kc_role", uniqueConstraints = {@UniqueConstraint(columnNames = {"realmId", "clientId", "name"})})
@TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonbType.class)}) @TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonbType.class)})
public class JpaRoleEntity extends AbstractRoleEntity implements JpaRootEntity { public class JpaRoleEntity extends AbstractRoleEntity implements JpaRootEntity {

View file

@ -25,7 +25,7 @@ limitations under the License.
<!-- format of id of changeSet: client-scopes-${org.keycloak.models.map.storage.jpa.Constants.SUPPORTED_VERSION_CLIENT_SCOPE} --> <!-- format of id of changeSet: client-scopes-${org.keycloak.models.map.storage.jpa.Constants.SUPPORTED_VERSION_CLIENT_SCOPE} -->
<changeSet author="keycloak" id="client-scopes-1"> <changeSet author="keycloak" id="client-scopes-1">
<createTable tableName="client_scope"> <createTable tableName="kc_client_scope">
<column name="id" type="UUID"> <column name="id" type="UUID">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>
</column> </column>
@ -34,33 +34,33 @@ limitations under the License.
</column> </column>
<column name="metadata" type="json"/> <column name="metadata" type="json"/>
</createTable> </createTable>
<ext:addGeneratedColumn tableName="client_scope"> <ext:addGeneratedColumn tableName="kc_client_scope">
<ext:column name="entityversion" type="INTEGER" jsonColumn="metadata" jsonProperty="entityVersion"/> <ext:column name="entityversion" type="INTEGER" jsonColumn="metadata" jsonProperty="entityVersion"/>
<ext:column name="realmid" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fRealmId"/> <ext:column name="realmid" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fRealmId"/>
<ext:column name="name" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fName"/> <ext:column name="name" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fName"/>
</ext:addGeneratedColumn> </ext:addGeneratedColumn>
<createIndex tableName="client_scope" indexName="client_scope_entityVersion"> <createIndex tableName="kc_client_scope" indexName="client_scope_entityVersion">
<column name="entityversion"/> <column name="entityversion"/>
</createIndex> </createIndex>
<createIndex tableName="client_scope" indexName="client_realmId_name" unique="true"> <createIndex tableName="kc_client_scope" indexName="client_realmId_name" unique="true">
<column name="realmid"/> <column name="realmid"/>
<column name="name"/> <column name="name"/>
</createIndex> </createIndex>
<createTable tableName="client_scope_attribute"> <createTable tableName="kc_client_scope_attribute">
<column name="id" type="UUID"> <column name="id" type="UUID">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>
</column> </column>
<column name="fk_root" type="UUID"> <column name="fk_root" type="UUID">
<constraints foreignKeyName="client_scope_attr_fk_root_fkey" references="client_scope(id)" deleteCascade="true"/> <constraints foreignKeyName="client_scope_attr_fk_root_fkey" references="kc_client_scope(id)" deleteCascade="true"/>
</column> </column>
<column name="name" type="VARCHAR(255)"/> <column name="name" type="VARCHAR(255)"/>
<column name="value" type="text"/> <column name="value" type="text"/>
</createTable> </createTable>
<createIndex tableName="client_scope_attribute" indexName="client_scope_attr_fk_root"> <createIndex tableName="kc_client_scope_attribute" indexName="client_scope_attr_fk_root">
<column name="fk_root"/> <column name="fk_root"/>
</createIndex> </createIndex>
<createIndex tableName="client_scope_attribute" indexName="client_scope_attr_name_value"> <createIndex tableName="kc_client_scope_attribute" indexName="client_scope_attr_name_value">
<column name="name"/> <column name="name"/>
<column name="VALUE(255)" valueComputed="VALUE(255)"/> <column name="VALUE(255)" valueComputed="VALUE(255)"/>
</createIndex> </createIndex>

View file

@ -25,7 +25,7 @@ limitations under the License.
<!-- format of id of changeSet: clients-${org.keycloak.models.map.storage.jpa.Constants.SUPPORTED_VERSION_CLIENT} --> <!-- format of id of changeSet: clients-${org.keycloak.models.map.storage.jpa.Constants.SUPPORTED_VERSION_CLIENT} -->
<changeSet author="keycloak" id="clients-1"> <changeSet author="keycloak" id="clients-1">
<createTable tableName="client"> <createTable tableName="kc_client">
<column name="id" type="UUID"> <column name="id" type="UUID">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>
</column> </column>
@ -34,17 +34,17 @@ limitations under the License.
</column> </column>
<column name="metadata" type="json"/> <column name="metadata" type="json"/>
</createTable> </createTable>
<ext:addGeneratedColumn tableName="client"> <ext:addGeneratedColumn tableName="kc_client">
<ext:column name="entityversion" type="INTEGER" jsonColumn="metadata" jsonProperty="entityVersion"/> <ext:column name="entityversion" type="INTEGER" jsonColumn="metadata" jsonProperty="entityVersion"/>
<ext:column name="realmid" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fRealmId"/> <ext:column name="realmid" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fRealmId"/>
<ext:column name="clientid" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fClientId"/> <ext:column name="clientid" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fClientId"/>
<ext:column name="protocol" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fProtocol"/> <ext:column name="protocol" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fProtocol"/>
<ext:column name="enabled" type="BOOLEAN" jsonColumn="metadata" jsonProperty="fEnabled"/> <ext:column name="enabled" type="BOOLEAN" jsonColumn="metadata" jsonProperty="fEnabled"/>
</ext:addGeneratedColumn> </ext:addGeneratedColumn>
<createIndex tableName="client" indexName="client_entityVersion"> <createIndex tableName="kc_client" indexName="client_entityVersion">
<column name="entityversion"/> <column name="entityversion"/>
</createIndex> </createIndex>
<createIndex tableName="client" indexName="client_realmId_clientId" unique="true"> <createIndex tableName="kc_client" indexName="client_realmId_clientId" unique="true">
<column name="realmid"/> <column name="realmid"/>
<column name="clientid"/> <column name="clientid"/>
</createIndex> </createIndex>
@ -54,20 +54,20 @@ limitations under the License.
</ext:createJsonIndex> </ext:createJsonIndex>
--> -->
<createTable tableName="client_attribute"> <createTable tableName="kc_client_attribute">
<column name="id" type="UUID"> <column name="id" type="UUID">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>
</column> </column>
<column name="fk_root" type="UUID"> <column name="fk_root" type="UUID">
<constraints foreignKeyName="client_attr_fk_root_fkey" references="client(id)" deleteCascade="true"/> <constraints foreignKeyName="client_attr_fk_root_fkey" references="kc_client(id)" deleteCascade="true"/>
</column> </column>
<column name="name" type="VARCHAR(255)"/> <column name="name" type="VARCHAR(255)"/>
<column name="value" type="text"/> <column name="value" type="text"/>
</createTable> </createTable>
<createIndex tableName="client_attribute" indexName="client_attr_fk_root"> <createIndex tableName="kc_client_attribute" indexName="client_attr_fk_root">
<column name="fk_root"/> <column name="fk_root"/>
</createIndex> </createIndex>
<createIndex tableName="client_attribute" indexName="client_attr_name_value"> <createIndex tableName="kc_client_attribute" indexName="client_attr_name_value">
<column name="name"/> <column name="name"/>
<column name="VALUE(255)" valueComputed="VALUE(255)"/> <column name="VALUE(255)" valueComputed="VALUE(255)"/>
</createIndex> </createIndex>

View file

@ -25,7 +25,7 @@ limitations under the License.
<!-- format of id of changeSet: roles-${org.keycloak.models.map.storage.jpa.Constants.SUPPORTED_VERSION_ROLE} --> <!-- format of id of changeSet: roles-${org.keycloak.models.map.storage.jpa.Constants.SUPPORTED_VERSION_ROLE} -->
<changeSet author="keycloak" id="roles-1"> <changeSet author="keycloak" id="roles-1">
<createTable tableName="role"> <createTable tableName="kc_role">
<column name="id" type="UUID"> <column name="id" type="UUID">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>
</column> </column>
@ -34,17 +34,17 @@ limitations under the License.
</column> </column>
<column name="metadata" type="json"/> <column name="metadata" type="json"/>
</createTable> </createTable>
<ext:addGeneratedColumn tableName="role"> <ext:addGeneratedColumn tableName="kc_role">
<ext:column name="entityversion" type="INTEGER" jsonColumn="metadata" jsonProperty="entityVersion"/> <ext:column name="entityversion" type="INTEGER" jsonColumn="metadata" jsonProperty="entityVersion"/>
<ext:column name="realmid" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fRealmId"/> <ext:column name="realmid" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fRealmId"/>
<ext:column name="name" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fName"/> <ext:column name="name" type="VARCHAR(36)" jsonColumn="metadata" jsonProperty="fName"/>
<ext:column name="clientid" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fClientId"/> <ext:column name="clientid" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fClientId"/>
<ext:column name="description" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fDescription"/> <ext:column name="description" type="VARCHAR(255)" jsonColumn="metadata" jsonProperty="fDescription"/>
</ext:addGeneratedColumn> </ext:addGeneratedColumn>
<createIndex tableName="role" indexName="role_entityVersion"> <createIndex tableName="kc_role" indexName="role_entityVersion">
<column name="entityversion"/> <column name="entityversion"/>
</createIndex> </createIndex>
<createIndex tableName="role" indexName="role_realmId_clientid_name" unique="true"> <createIndex tableName="kc_role" indexName="role_realmId_clientid_name" unique="true">
<column name="realmid"/> <column name="realmid"/>
<column name="clientid"/> <column name="clientid"/>
<column name="name"/> <column name="name"/>
@ -56,20 +56,20 @@ limitations under the License.
</ext:createJsonIndex> </ext:createJsonIndex>
--> -->
<createTable tableName="role_attribute"> <createTable tableName="kc_role_attribute">
<column name="id" type="UUID"> <column name="id" type="UUID">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>
</column> </column>
<column name="fk_root" type="UUID"> <column name="fk_root" type="UUID">
<constraints foreignKeyName="role_attr_fk_root_fkey" references="role(id)" deleteCascade="true"/> <constraints foreignKeyName="role_attr_fk_root_fkey" references="kc_role(id)" deleteCascade="true"/>
</column> </column>
<column name="name" type="VARCHAR(255)"/> <column name="name" type="VARCHAR(255)"/>
<column name="value" type="text"/> <column name="value" type="text"/>
</createTable> </createTable>
<createIndex tableName="role_attribute" indexName="role_attr_fk_root"> <createIndex tableName="kc_role_attribute" indexName="role_attr_fk_root">
<column name="fk_root"/> <column name="fk_root"/>
</createIndex> </createIndex>
<createIndex tableName="role_attribute" indexName="role_attr_name_value"> <createIndex tableName="kc_role_attribute" indexName="role_attr_name_value">
<column name="name"/> <column name="name"/>
<column name="VALUE(255)" valueComputed="VALUE(255)"/> <column name="VALUE(255)" valueComputed="VALUE(255)"/>
</createIndex> </createIndex>