Hello Team,
I made the mistake of forgetting to alter one of the columns' data types during the external database integration. The user also requested that the table's name be changed. Almost six months have passed, and the data is finally in the table. We don't want the table's data to be lost.Is it possible for us to modify the table's name and the column's data type?
If I change the name of the table, the physical table name remains the same, & in the advanced query, I did not get the data as the name has changed.
Please provide the best option so that I don't lose the data and can get the desired outcome.
You can not change the physical table name, outsystem wont allow you because it is common name in all environments, so you can't change the physical table name.
If you want different physical table name , there is only one option creating a new table.
You can change the column data type, but it depends on previous data type and there are limitations due to data.
Create a new table with a proper table name you required.Example if table name is "Employee" then Physical table name will be "OSUSR_cbg_Employee" and create a same attribute in old table and data you are getting from external databse, so you are changing table name in outsystem integration studio and also change columns data type(Note: there are limitations).
Hello Pradip,
Can you please confirm if you want to change table name into external database or in OutSystems logical name only?
Regarding changing data type of column you can change it but also based on number of records existing in table as if its million of records this change may take long time and may also fail.
As its production environment so first of all its better to backup your table first before doing any changes then in case lose of any data you can insert data again from backup table to original table.
Hey @Pradip Chavhan
Please let me know which external database you are using, depending on that there will be multiple ways to do it
1) Create new table - example - create table NewTable as select * from OldTable
2) if you are using Oracle you can use Rename Table https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqljrenametablestatement.html
After renaming or creating new table you have to reintegrate it and have to reconnect it to your modules all again
To Change column datatype you have to make sure that new datatype can hold all the data example integer cant hold text data
ALTER TABLE NewTable MODIFY COLUMN OldColumn Datatype;
Create new column with the new datatye then run the Update query likeALTER TABLE NewTable ADD NewColumn Datatype;Update NewTable set NewColumn = OldColumn;
also, check out this StackOverflow question for a similar querysql server - Change type of a column with numbers from varchar to int - Stack Overflow
Hi Pradip,
As you already have the external database in production and connected to your OutSystems application, it is upmost important to have a good plan, or else you end up with a high possibility that your application is not working as expected for a longer period than necessary.
Simple approach, with significant downtime
Alternative approach, with zero-downtime
Regards,
Daniel
SQL Server is the external database that I'm using. In any case, I must update the extension to make this adjustment.Since the column currently only contains the values 1 and 0, I am not concerned about changing the data type of the column.
In outsystems data model, we have 1 table/entity with the name A. On the other side of the physical table, we have tables A & A1. And the actual data is in Table A1 but aggregates point to Table A.
How do I resolve this issue?
Can we make a change to the below entity?
You can read and update the entity as any other entity. But be careful with changing OutSystems meta data entity records. Make sure you can revert your changes if they don't give that desires outcome.