PecanProject / bety

Web-interface to the Biofuel Ecophysiological Traits and Yields Database (used by PEcAn and TERRA REF)
https://www.betydb.org
BSD 3-Clause "New" or "Revised" License
16 stars 38 forks source link

Migration fails on pfts.modeltype_id #126

Closed mdietze closed 10 years ago

mdietze commented 10 years ago

In updating bety on psql-pecan.bu.edu I got the following errors in the migration

PG::NotNullViolation: ERROR: column "modeltype_id" contains null values : ALTER TABLE "pfts" ALTER "modeltype_id" SET NOT NULL/usr/local/bety/db/migrate/20140729045640_add_model_type_table.rb:19:in `up'

I'm not sure how to fix this in the database since the null column is showing up during the migration itself, so I can't just go in by hand and figure out which PFT has a NULL

robkooper commented 10 years ago

This means there is a pft which does not have a modeltype associated with it, or a modeltype that does not have a model associated. You can run the following command to find them:

select * from pfts where model_type is null or model_type not in (select model_type from models);
mdietze commented 10 years ago

Ok, that helped (DALEC had model_type BIOCRO in the models table but DALEC in the pfts because the models didn't allow DALEC as an option in the pull down).

Now I can't figure out why the sites table doesn't show up at all, but just gives an error message. Is there a place I can check an error log or something like that?

On Aug 15, 2014, at 8:08 AM, Rob Kooper notifications@github.com<mailto:notifications@github.com> wrote:

This means there is a pft which does not have a modeltype associated with it, or a modeltype that does not have a model associated. You can run the following command to find them:

select * from pfts where model_type is null or model_type not in (select model_type from models);

— Reply to this email directly or view it on GitHubhttps://github.com/PecanProject/bety/issues/126#issuecomment-52316359.

robkooper commented 10 years ago

make sure you have changed the con/database.yml to use postgis instead of postgresql. If not it will not be able to use parse the postgis settings for the sites.

mdietze commented 10 years ago

That seems to do it, thanks Rob