[Nitro] Automatic object evolution

Rob Pitt rob at motionpath.com
Thu Oct 27 08:26:21 EDT 2005


Good idea.

I have done this in the manner you two suggested and you can check it 
out for improvement from our darcs repository on 
http://nitro.lego.motionpath.com by doing a darcs get. You need the 
following patches (applied in order):



Tue Oct 25 17:13:59 BST 2005  rob at motionpath.com
  * Postgresql adapter modified to check if table exists via internal 
postgresql commands and join table existence checked seperately from 
main table existence to allow proper extension and self healing


Thu Oct 27 11:05:47 BST 2005  rob at motionpath.com
  * FIXED: Bad memory usage for previous table existence checker. ADDED: 
Table evolution in Postgresql library, automatically creates new fields 
as needed, warns about fields no longer needed or deletes them if 
:evolve_schema is enabled in Og database manager options. TODO: Should 
also interrogate field types and modify them if people do things like 
changing string to integer (why?)

Thu Oct 27 13:20:24 BST 2005  rob at motionpath.com
  * Revised table evolution patched using TRANS suggestion from ML

Thu Oct 27 13:22:37 BST 2005  rob at motionpath.com
  * Table evolution revised to use true value instead of strings

-- Rob.

Zachary Zolton wrote:

>In setting :evolve_schema, couldn't we use use the value true instead
>of the string 'true'?
>
>
>On 10/27/05, TRANS <transfire at gmail.com> wrote:
>  
>
>>On 10/27/05, Rob Pitt <rob at motionpath.com> wrote:
>>    
>>
>>>Ahh conflicting information!
>>>
>>>George wants interactive, me and Chris want it settable with options
>>>when doing Og.setup and you want methods :)
>>>      
>>>
>>I'm not so sure we "want", I think it's more just suggsting possible solution.
>>
>>    
>>
>>>Here is how I see this then,
>>>
>>>Interactive is the default behaviour.
>>>You can set options like:
>>>      
>>>
>>Ah this helps.
>>
>>    
>>
>>>  Og.setup(
>>>        :store => 'psql',
>>>        :address => 'host',
>>>        :name => 'database',
>>>        :user => dbclient',
>>>        :password => 'naughty',
>>>        :evolve_schema => 'true' <------------- this would cause both
>>>create and delete to happen non-interactively but would log info in
>>>debug mode
>>>      
>>>
>>Okay, but the default if not given is false.
>>
>>    
>>
>>>        :evolve_schema_constructive => 'true' <---------- this would
>>>cause creates to happen silently but prompt for delete
>>>      
>>>
>>I'm not so sure about prompting. Prompting is generally not a good
>>idea --that's why we have settings like this one. How about:
>>
>>        :evolve_schema_cautious => 'true' <---------- this would
>>    
>>
>>>cause creates to happen but not deletes.
>>>      
>>>
>>only applies if evolve_schema is set and it should default to true.
>>
>>    
>>
>>>        :evolve_schema_destructive => 'true' <---------- this would
>>>cause deletes to happen silently but prompt for creates
>>>      
>>>
>>This last one I think is useless.
>>
>>The reason I take this approach  is because it is too easy to
>>inadvertantly cause a field delete, and if your working in live-data
>>conditions by chance....well, I hope you remembered to back-up!
>>
>>T.
>>
>>_______________________________________________
>>Nitro-general mailing list
>>Nitro-general at rubyforge.org
>>http://rubyforge.org/mailman/listinfo/nitro-general
>>
>>    
>>
>
>_______________________________________________
>Nitro-general mailing list
>Nitro-general at rubyforge.org
>http://rubyforge.org/mailman/listinfo/nitro-general
>  
>




More information about the Nitro-general mailing list