Update on GenerateUpdateTriggersTask.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Update on GenerateUpdateTriggersTask.java

joe carlson
Hi Miners,

I have some changes on GenerateUpdateTriggersTask.java - the magic that
allows you to do manual SQL on an InterMine database without destroying
your data. Hopefully.

The new features are:

1) If you delete a record, referencing columns in other tables are set
to null - mimicking a 'ON DELETE SET NULL' action of a foreign key. And
referencing records in many-to-many collections are deleted.

2) If you have more than 2^31 intermineobjects, id's for new objects are
wrapped and are negative. I've corrected the code for generating new
id's and for resetting the sequence for generating new id's in this
case. (Yes, I have this problem.)

3) If you try to truncate table, you get an error message and nothing
happens. I haven't been able to write the triggers that handle
truncates, so I've disabled truncating tables when the triggers are

4) There is a new file generated, key-checker.sql, that allows you to do
a sanity check on your database to look for dangling references. The
command "psql your_mine < key-checker.sql" will scan every table for
references and report the number of cases in which a referenced record
does not exist. This can arise - I've learned - if you do not specify
integration keys properly.

Anyone interested in testing? Should I generate a pull request?


dev mailing list
[hidden email]