Hi Cory,
I have two comments on this. The first is that XNAT actually regenerates those particular views (i.e., displayfields_*) on start-up if they don’t exist. This means you could actually just drop all of them, make the changes suggested in xdat.log, then re-start Tomcat, and those views will be restored automatically. A nice script for this is something like:
psql --username=xnat --tuples-only --no-align --command="select table_name from information_schema.tables where table_name ~ '^displayfields_.*'" | while read VIEW; do
psql --username=xnat --command="DROP VIEW ${VIEW}"
done
The second thing is that XNAT provides some functions in its database schema that you can use to save and drop tables dependencies (and later restore those dependencies). There are three functions that are useful here:
The first one just tells you which other tables/views have dependencies on another particular table/view, e.g.:
xnat=> SELECT * FROM dependencies_identify('xnat_resource');
view_schema | view_name | view_type
-------------+------------------------------------+-----------
public | displayfields_xnat_resourcecatalog | v
(1 row)
This is what the error message told you:
DETAIL: view displayfields_xnat_mrscandata depends on column parameters_flip of table xnat_mrscandata
Use dependencies_save_and_drop() to drop any dependencies:
xnat=> SELECT * FROM dependencies_save_and_drop('xnat_resource');
dependencies_save_and_drop
----------------------------
1
(1 row)
Now make your changes from the suggested SQL. You should be able to make these changes without running into the dependency issue because the dependencies are now gone. Once you’ve finished your changes, just restore the deleted dependencies with dependencies_save_and_drop():
xnat=> SELECT * FROM dependencies_restore('xnat_resource');
dependencies_restore
----------------------
1
(1 row)
If you re-run dependencies_identify() now, you’ll see that you’re back to where you were.
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
xnat_discussi...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/xnat_discussion/a8e97138-c15b-4c36-8ef8-a68af2da6462n%40googlegroups.com.
No, those are ALTER statements that XNAT is running itself. It tries to update its schema when possible but in situations where there are dependencies or something where XNAT (okay, me, it was me that wrote that) can’t figure out how to change the schema on its own it just writes them out into the optional statements in the log.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/a7ba9b7b-c128-474f-a240-df75c2e0eb6dn%40googlegroups.com.