How to make a plugin create a table in jira database

I've created a jira plugin in my own postgres database. For so, I needed to create a table in the jira database to save some informations (I called it environments). Now I'm trying to integrate it in another Jira software that uses mysql database.

What's really gonna be ideal is to write some script that make my table (environments) to be created automatically. I mean, is there an alternative to not create the table manually? Most of plugins do this but I have no idea how they do it. can anyone suggest me a tutorial or give me some good informations about this?

1 answer

1 accepted

2 votes
Accepted answer

Use active objects - the plugins you've seen creating their own tables do it with tables named AO_<plugin key>_name.


Thank you for the fast response. I'll do some reading about this active objects and come back to you. thanks again!

Actually i saw someone who created the table this way:

In entitymodel.xml he adds:

<entity entity-name="EnvTest" table-name="EnvTest" packagename="">
<field name="id" type="numeric"/>
<field name="name" type="long-varchar"/>
<field name="address" col-name="empaddress" type="long-varchar"/>
<field name="company" type="long-varchar"/>
<prim-key field="id"/>
<index name="emp_entity_name">
<index-field name="name"/>


and in entitygroup.xml:
<entity-group group="default" entity="EnvTest"/>


I tried this but unfortunately this didn't work for me. Can you please tell me the reason why?

That it a really bad way to do it.  This file is used when creating an empty JIRA database and for defining what to read out into an xml backup.  For an existing JIRA, you would need to manually create the table.

You'd then have to implement all the code required to read and write the table, and you would be unsopported by Atlassian.

Use the AO tables, they're not ideal for some uses, but they are the recommended approach.

Hi again,

So I have followed this tutorial you gave me:

the plugin has been built succesfully and i downloaded it in my jira software but I didn't see any table created

When I run some script to list all the tables in my database (this script: SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;) I do see some tables names starting with AO, one of them is AO_5EFAF5_TODO. But when i run this script for exemple : select * from AO_5EFAF5_TODO;  I get this error : relation "ao_5efaf5_todo" does not exist. 

Okey I'm sorry it's working now!

Thank you so much.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,363 views 14 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you