View Full Version : Deploying strucutre change without overriding data

2014-10-07, 13:13

Not sure how to do this.
For example, I have an app with a table that has 3 columns. lets say I deploy the table to production along with the app and then add a hundred rows.

Then I need to add an additional column in the application. When I redeploy the table, my live data is lost.

Typically, I will be using SQL Server as my backend, so it wouldn't matter, but in this case its a local table.
What's the best way to handle this?



2014-10-07, 13:35
Hi Herb,

what I do in the current product (in VFP hitting SQL) is run a modify routine that alters the SQL Server data to match the EXE running. There's quite a bit to it, but once done, it gets used forever, as it were.

I'm in the process of moving that capability to Lianja. Lianja's additional commands actually makes it easier than it was in VFP.

Barry has mentioned doing something about data structure updates, but I don't see anything in the roadmap.

Anyway, that's my #1 side project at the moment. I'm working from xCase, but the data update routine will pretty much standalone. When completed, you would deploy the structure of your tables in xml along with this routine, and have it check in the App INIT (quick CRC32 table checks) whether a particular table needs to be updated. It would then go ahead and do the update, converting the data type if needed, etc., and then your app is good to go.

In the meantime, you can manually do the same thing: have a routine that uses columnexists() to know whether to add the field to the table, in the INIT, before anything else runs (as you will need to use the table exclusive). You can at the same time take care of any index that needs to be supplied, etc.



2014-10-07, 14:56
Interesting Idea Hank.