New topic: Processes Procedures and code for Database Maintenance?
<http://forums.realsoftware.com/viewtopic.php?t=46928> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message tseyfarth Post subject: Processes Procedures and code for Database Maintenance?Posted: Wed Feb 13, 2013 12:24 am Joined: Sat Dec 04, 2010 9:14 pm Posts: 812 Hello all, Tim H was kind enough to give me a kick off for programatically maintaining a database as an application is developed and updated over time. His idea was to use code that during the startup of the application would check its code, against the existing database (if any). This approach seems reasonable but I thought I would ask the community at large what their thoughts are. This would be the very first time I have delved into this kind of challenge. Previously I took the wimps way out and simply backed up, and replaced the existing db. This meant new install and set up- lots of wasted time. And more importantly, reportable data was lost, deligated to a backup and a harder method to obtain (reports) if necessary! This time, I would like to solve this problem properly and completely from the beginning. The conceptual challenges I have with the programmatic method (which I do think is better than comparing a new db to the old db) are: 1. How does the code *know* that a field length has changed? Or a Field data type has changed? 2. How does the code know that a field name has simply been changed? 3. Field additions appear fairly straightforward. But what about deletions? Are they name changes or true deletions? Once the conceptual understanding is obtained, how to code to compare? Tim H and my ideas were to use the db schema, and compare that to a table list. TableFieldNames = array("tamper_events","pms_updates","alarm_events","door_close_events","door_open_events","exit_attempts", "entry_attempts",_ "last_updated_date_time", "rowid", "datex", "invalid_code", "other_access_attempts") But then what would be the best method to track the field *data type*? One idea I had was to compare the data type for the matching field Property - but how to programatically know the data type of a particular Property? Does anyone have any idea, suggestions or code samples/snippets they would like to share? I did check the RSDS Code Library, but did not see anything that would do this. Also, initial targeted DB Is SQLite, but PostgreSQL will be necessary as well not long after this implementation. Thanks again all! Tim Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
