Thanks Colin.

It's not practical to change the database as data arrives from a 3rd
party provider with a particular structure.

You're note made me realize that I'm going about this the wrong way,
however. I didn't even think to use transactions on insert. I'm
accustomed to an old system where transactions aren't supported and this
didn't enter my thinking. What I'm trying to accomplish shouldn't really
be part of my testing code.

Thanks.

Colin Law wrote in post #1165987:
> On 4 January 2015 at 21:50, D.c. Zzz <li...@ruby-forum.com> wrote:
>> --etc.
> I would start by, as far as practical, normalising the database so
> that there are no such potential inconsistencies.
>
> Next if it is suggested that it is not practical to fully normalise it
> then probe the logic behind that carefully to make sure it is really
> true.  Do not just assume that something that seems like a good idea
> from the performance aspect is necessarily worthwhile.  Decades of
> experience in the S/W industry has shown time and again that the
> bottlenecks in an app are virtually never where they are initially
> anticipated.
>
> Next if it is absolutely not practical to fully normalise it then
> arrange all updates using transactions such that if an inconsistency
> arises it must be a bug.
>
> Next have a comprehensive set of automatic tests that attempt to get
> inconsistent data into the database.
>
> Finally have a task which is run on the server at appropriate times,
> possibly via cron or automatically invoked when data are updated, that
> performs the checks and sounds a siren if a bug is detected.
>
> Colin

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c463245c2265b00ed08e250c534c0475%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to