Background
How can I change an attribute from one data type to another?
In the simplest cases like increasing the length of a String column, xDM will alter the physical columns for you automatically when re-deploying the data location.
Here's a more complex case. We deploy a model with the attribute GeocodedAddress.Quality with type String(128). Later we realize that a more appropriate data type would be Integer.
Standard solution
- Drop your tables.
- Redeploy.
This is a solid solution. It will always work.
But at development time, sometimes it can be a hassle to lose all data and then re-load.
Alternate solution
- Directly alter your tables.
- Redeploy.
This is a nice time saver at development time. It's not recommended for a production data location.
Sample SQL to alter tables (PostgreSQL syntax shown):
alter table SA_ADDRESS_CACHE alter column GEOQUALITY type decimal(10,0) using GEOQUALITY::decimal(10,0) ; alter table GX_ADDRESS_CACHE alter column GEOQUALITY type decimal(10,0) using GEOQUALITY::decimal(10,0) ; alter table GD_ADDRESS_CACHE alter column GEOQUALITY type decimal(10,0) using GEOQUALITY::decimal(10,0) ; /* Of course this will fail if your data contains non-numeric values. That shouldn't surprise anyone. */