I got a column 'description' and it's current type is 'string'.
I need to provide more space for users to enter addtional data, and therefore I would like to convert it from 'string' into 'textarea',
but when I change the configuration I'm getting an error.
How can I convert the type ?
Although the TGE addon is creating table and columns automatically, it is not guaranteed that it can alter the configuration of the table in the database. The addon will do its best, but depending on the existing data the database server will probably refuse to change the type of the column to prevent data loss. So changing the type of the column in the grid configuration could work, but we do not advise to do that as results of that operation could vary depending on the database vendor and the existing data.
There is a safe and predictable way to change the column type, but it requires some additional "manual" actions and has to be performed very accurately to prevent data loss. This short guide deals with migrating a column from string to textarea, but that same approach can be used for other column types migrations.
- In your grid configuration, add a new column with type=textarea - with another id. This will add a new column to the database table.
- Compose and run SQL query(ies) which would transfer the data from the original string column to the new column. Check that it worked correctly.
If you need the name of the column to be the same after the type migration (for example, there are other applications that use that table and that exact column and renaming it is not an option), the scenario is more complicated
- Lets say you have a column 'description' in your grid and you want to change its type in grid configuration from 'string' to 'textarea'
- In your grid configuration, add a new column with type=textarea - with another id, say 'description_new'. This will add a new column 'description_new' to the database table.
- Compose and run SQL query(ies) which would transfer the data from the original string column 'description' to the new column 'description_new'. Check that it worked correctly.
- Make sure no one is using the TGE add-on at the moment as we are going to change the grid configuration and do some manual schema update operations in the database directly. If anyone is editing grid content at that moment - the data could be lost.
- Update grid configuration:
- Remove the new column 'description_new'
- Update the definition of the column description. Set the type to 'textarea'
- Go to the database and update the table definition
- Drop the column 'description' (we already moved the data to the new column 'description_new' which has the right column type)
- Rename the column 'description_new' to 'description'
- Check that it works as expected. Now you can let others use TGE
Alternative step-by-step guide
Provided by one of the TGE users.
Workaround to change size of columns from string to text area:
- Modify the idalko table grid field configuration for desired fields from string to textarea.
- Bring jira app offline (shutdown) and then alter corresponding database table field datatypes from varchar(255) to TEXT.
- Restart jira
- Existing data will be retained and newly created issues will accept multiline text.