bety: BETYdb 3.3.1
Main Authors: | gsrohde, Carl Crott, mulroony, Jeremy Kemball, David LeBauer, Rob Kooper, YL, jschen3, andrewshirk, Zhengqi Yang, MarvinJ, udaysaraf, Michael Dietze |
---|---|
Format: | info software Journal |
Terbitan: |
, 2015
|
Online Access: |
https://zenodo.org/record/13775 |
Daftar Isi:
- This release implements changes to the database schema discussed in Github issue #145 and makes a few related changes. It consists of a single migration file together with an updated version of production_structure.sql. Changes Pertinent to PEcAn Users Administrators need to do a database migration. [The BETYdb web interface, however, will, for now, continue to function as before even without doing the pending migration.] See "Database Changes" below. Summary of Changes Database Changes Administrators need to do database migrations! The database version for this release is 20141208165401. A new table cultivars_pfts has been added so that PFTs consisting of cultivars rather than of species may be formed. Uniqueness, foreign-key, and non-null constraints have been added to this new table and to the existing pfts_species table. pfts_species and cultivars_pfts have been constrained in such a way that a PFT may be associated with a set of species or with a set of cultivars but not with a set containing both species and cultivars. A uniqueness constraint has bee added to pfts to ensure that names are unique within the set of PFTs of a given model type. (PFTs associated with different model types, however, may have the same name.) Additional Notes Other than the addition of addition of a migration, the Rails code is essentially unchanged. In particular, no facility has yet been added in the Rails code to work with PFTs consisting of cultivars. The foreign key constraints have been designed in such a way that a PFT may be removed without having to first empty it of species or cultivars. This is as before, except that now, all entries in the join tables pfts_species and cultivars_pfts that refer to the removed PFT are automatically removed as well. Species and cultivars, however, may not be removed if they belong to any PFT. They must first be removed from all PFTs containing them before they themselves can be removed. The migration will fail if your copy of the bety database violates any of the new uniqueness constraints. In particular, pfts are now required to be unique by (name, modeltype_id). The master database on ebi-forecast has recently been updated to comply with this constraint, so it is recommended to update your copy of the pfts table to mirror the changes made there. A query that can be used to find the offending rows is select array_agg(id) as id_list, name, modeltype_id, count(*) from pfts group by name, modeltype_id having count(*) > 1; Most likely, this will produce only a row or two, each with an array of pft id numbers containing only two or three entries. Thus only two or three rows of the pfts table need be updated which can easily be done manually. (I found it sufficed to update the name in row 83 to 'plants2' and the name in row 95 to 'plants3'. Visit the PFT pages at https://www.betydb.org to see what the name for any particular id number has been changed to in the master database. For example, to see the current name used for the PFT with id=95, visit https://www.betydb.org/pfts/95.) Status of RSpec Tests All tests continue to pass when run in the default environment and can be run using the command bundle exec rspec Complete details for running the rspec tests are on the updated Wiki page at https://github.com/PecanProject/bety/wiki/Automated-Tests