camptocamp / c2cgeoportal

c2cgeoportal application
http://geomapfish.org
Other
64 stars 46 forks source link

[1.6.7rc6] Attribute "description" is not added to database on update command #1903

Closed gnerred closed 8 years ago

gnerred commented 8 years ago

I have upgraded my preprod to 1.6.7rc6 with pip install -> OK

I have then upgraded my prod with following commands :

make -f prod.mk update make -f prod.mk build

-> error 500 on prod :

ProgrammingError: (ProgrammingError) column treeitem.description does not exist ProgrammingError: (ProgrammingError) column layergroup_treeitem.description does not exist

I had to add manually this two columns in the schema main of the prod -> OK

It seems that there is a problem with the update command, the step to upgrade the database is missing or is incomplete somewhere.

rbovard commented 8 years ago

Did you did this step?

https://github.com/camptocamp/c2cgeoportal/blob/1.6/c2cgeoportal/scaffolds/update/CONST_CHANGELOG.txt_tmpl#L7-L13

gnerred commented 8 years ago

Yes, that's why I had no problem on my preprod instance. The problem was when upgrading my prod.

rbovard commented 8 years ago

But did you get your changes in prod with git pull origin <branch>?

gnerred commented 8 years ago

Isn't it automatically done by command make -f prod.mk update ? If I look at my prod, I have the change you mention in my deploy.cfg.mako file.

rbovard commented 8 years ago

Indeed, you're right...

I'm out of ideas, sorry

gnerred commented 8 years ago

thank you anyway :O)

kalbermattenm commented 8 years ago

Are the DB for preprod and prod the same ?

I do not know if the update command runs the alembic upgrades (the thing which upgraded your preprod instance).

If not, then your error would be normal and you would have to run (after the git pull):

.build/venv/bin/alembic upgrade head
.build/venv/bin/alembic -c alembic_static.ini upgrade head
gnerred commented 8 years ago

No, they are 2 different DB. The aim of the update command is to upgrade automatically, I cannot immagine that we have to run other commands manually. @sbrunner, could you please analyze this problem ?

sbrunner commented 8 years ago

What does those commends return?

.build/venv/bin/alembic current -v
.build/venv/bin/alembic heads -v
gnerred commented 8 years ago

.build/venv/bin/alembic current -v

INFO  [alembic.migration] Context impl PostgresqlImpl.
INFO  [alembic.migration] Will assume transactional DDL.
Current revision(s) for postgresql://www-data:XXXXX@localhost:5432/cartoriviera:
Rev: 2b8ed8c1df94
Parent: 32527659d57b
Branch names: 1.6
Path: /var/www/vhosts/cartoriviera/private/cartoriviera_geomapfish/CONST_alembic/main/versions/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py

    Set layergroup_treeitem.id as a primary key

    Revision ID: 2b8ed8c1df94
    Revises: 26a8c51827c6
    Create Date: 2015-10-29 16:11:24.760733

.build/venv/bin/alembic heads -v

Rev: 22e6dfb556de (head)
Parent: 2b8ed8c1df94
Branch names: 1.6
Path: /var/www/vhosts/cartoriviera/private/cartoriviera_geomapfish/CONST_alembic/main/versions/22e6dfb556de_add_description_tree_.py

    Add description column in the tree

    Revision ID: 22e6dfb556de
    Revises: 2b8ed8c1df94
    Create Date: 2015-12-04 13:44:42.475652
sbrunner commented 8 years ago

@gnerred do you use the deploy tool? If no how do you do to pass the application (code and database) from preprod to prod?

gnerred commented 8 years ago

I only do a "make -f prod.mk update", as you told me to do... It automatically takes the code from git. Is it not the same with database config ?

sbrunner commented 8 years ago

Than the database isn't neither updated and deployed... For the main schema you should do a dump restore from preprod to prod or do:

.build/venv/bin/alembic upgrade head

For the main_static schema you should do:

.build/venv/bin/alembic -c alembic_static.ini upgrade head

I's only when we use the deploy tool that it will automatically done :-)

gnerred commented 8 years ago

Ok so @kalbermattenm was right, it was a misunderstanding from my part, sorry, and thanks all for answers !

kalbermattenm commented 8 years ago

+1 for myself... :laughing:

gnerred commented 8 years ago

@kalbermattenm , if I understand well, those two commands update table structure in main and main_static schema ? No data is transfered, only commands like "alter table" are done ?

kalbermattenm commented 8 years ago

Yes exactly.

I just applies the ALTER commands on the schemes in order for them to correspond to the version of c2cgeoportal you are using, no data should be altered or deleted.

gnerred commented 8 years ago

Thanks again

sbrunner commented 8 years ago

Excellent :-)