# Database custom upgrade with liquidbase jar

**URL:** <https://forum.keycloak.org/t/database-custom-upgrade-with-liquidbase-jar/10382>\
**Category:** Extending the server\
**Tags:** database, upgrading\
**Created:** [August 4, 2021, 7:16am UTC](https://forum.keycloak.org/t/database-custom-upgrade-with-liquidbase-jar/10382 "2021-08-04T07:16:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivankovalenko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/ivankovalenko/32/1476_2.png) [@ivankovalenko](https://forum.keycloak.org/u/ivankovalenko)\
**Post date:** [August 4, 2021, 7:16am UTC](https://forum.keycloak.org/t/database-custom-upgrade-with-liquidbase-jar/10382/1 "2021-08-04T07:16:54Z")

</div>

We’ve decided to alter Keycloak database schema to hold large json documents in user attributes and add some tracking column to user\_attribute table.  
Is there a ready way to package these changes in jar to be deployed in Keycloak deployments catalog so that these changes were applied on deployment with liquidbase databaseupdater.

sql code is

```auto
alter table public.user_attribute alter column value set data type text;
alter table public.user_attribute add column if not exists change_src boolean DEFAULT false;
COMMENT ON COLUMN user_attribute.change_src IS 'my comment is here'

```

I’ve tried to mimic keycloak-model-jpa.jar, but not luck

```auto
./src/main/resources/META-INF/beans.xml
./src/main/resources/META-INF/services/org.keycloak.connections.jpa.JpaConnectionProviderFactory
./src/main/resources/META-INF/services/org.keycloak.connections.jpa.updater.JpaUpdaterProviderFactory
./src/main/resources/META-INF/services/org.keycloak.connections.jpa.updater.liquibase.conn.LiquibaseConnectionProviderFactory
./src/main/resources/META-INF/jpa-changelog-master.xml
./src/main/resources/META-INF/jpa-changelog-rir-user-entity-value.xml
./pom.xml

```

Do i have to repeat source code from keycloak-model-jpa.jar for applying migrations in my own jar?

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [August 4, 2021, 2:29pm UTC](https://forum.keycloak.org/t/database-custom-upgrade-with-liquidbase-jar/10382/2 "2021-08-04T14:29:53Z")

</div>

Perhaps this will help: [Server Developer Guide](https://www.keycloak.org/docs/latest/server_development/#_extensions_jpa)

But I strongly recommend not to extend/modify the existing Keycloak tables. You never know how they will evolve in future and this might crash with your changes. A non-working Keycloak environment and manual work for future updates are the possible results. Things that you don’t want to happen.  
Storing data in separate tables would be the better (and IMHO correct) way to do.
