How To Change The Size of a Column
The objective of this article is to show you how to change the size of a column inside the database. It enables the user to have a certain amount of flexibility within his/her database.
Before reading this guide, it is necessary to have a proper understanding of Openbravo's Modularity concept and how to create and package a module,
as we take the knowledge from these articles as a given in this guide.
In case you are working with configuration scripts or templates on a regular basis, the following link to an article might be of interest to you, since it describes how to create a configuration script.
In Openbravo you are able to change the size of a column. To achieve this you must follow the following steps:
- Create a template and set its status as "In Development".
- Modify the column size within the database with the "ALTER TABLE" SQL command.
- IMPORTANT: The new value must be greater than the old one.
Postgres: ALTER TABLE <table_name> ALTER COLUMN <column_name> type <type>(<new_size>) Oracle: ALTER TABLE <table_name> MODIFY <column_name> <type>(<new_size>)
- Update the new column size in the Application Dictionary. For this, we go to the "Tables and Columns" window, find the column definition and specify the new size there
- Export the database: "ant export.database" (with this you are exporting the template definitions)
- Export the configuration script: "ant export.config.script" (with this you are exporting the core changes into the template)
- Check the generated configuration script and verify that the change regarding the new column size appears in the first lines.