I need to store longer data than the default (which seems to be varchar(255) for strings). However, we've already started using my plugin in production, and the prod database already has a table with the schema of varchar(255). If I add annotations similar to what is mentioned in this question:
https://answers.atlassian.com/questions/80200/active-objects-unlimited-string-field-length
What will happen when I load that plugin into my prod instance? Will the old data be migrated? Will it go away? Will a new differently-named table be created then I can migrate the data manually? Any advice?
Community moderators have prevented the ability to post new answers.
Hi Carl,
if you simply change your schema (Active Objects interfaces) AO will try to update the database schema to reflect those change.
Note that this is not always possible. For example most databases won't let you change from a VARCHAR to an INTEGER column, or decrease the size of columns.
In your case this is a change that _should_ work. However I'd make sure to test it before releasing in production. Depending on how many databases you need to support this will be a more or less tedious thing to do.
The general approach to changing column types though is don't do it, add a new column with the new type and migrate the data, either lazily in your code or using the AO plugin's migration capability. As always test before going into production.
Some more information can be found here: https://developer.atlassian.com/display/AO/Upgrading+your+plugin+and+handling+data+model+updates
SaM - Thanks, this is a great answer! I appreciate it!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But the question remains, what if we have to do it? And what can we do while developping in order to reset a table? (change column from null to not null for example). I would like to recreate all the tables of my ActiveObjects to avoid problem. Is there a way to do that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Samuel Le Berrigaud, what if I need to add an additonal column to an existing active objects table in production. I have added it via the interface that extends Entity and done necessary changes in the service classes. However, it looks like the column is not getting updated. I have the Preload annotation set for the interface, but the column in simply not getting updated.
I tried looking into the documentation you provided for some hints : https://developer.atlassian.com/display/AO/Upgrading+your+plugin+and+handling+data+model+updates
But at the moment its taking me to documentation home page.
Please advise.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.