ERROR column answered

After upgrading to 21.02 I get the following error:

ERREUR: la colonne « answered » de la relation « call_log_participant » n’existe pas

I suppose database was not upgraded for some reason.
Should I run an updrade script to solve this issue ?

How did you upgrade your wazo?

wazo-upgrade but just after running it I just saw that postgres password was changed,
in the log:
FATAL: authentification par mot de passe échouée pour l’utilisateur « postgres »

After reseting the default password wazo-upgrade runned without any error. But still have a
ERREUR: la colonne « answered » de la relation « call_log_participant » n’existe pas

You can run the following command to fix it:

xivo-update-db

Then you can check the status with:

xivo-check-db
~# xivo-update-db
Updating database...
Updating database done.

and

~# xivo-check-db
Checking database...
	OK

but still have a 500 error:

sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) ERREUR:  la colonne call_log_participant_1.answered n'existe pas

need advice, what is the simpler way?

  • adding manually the missing column in db
  • (re)start on a fresh install and migrate all my settings (how?)
  • or else?

Oh I missed the step wazo-service restart

If you still have the error, can you show us the output of:

apt-cache policy wazo-call-logd xivo-manage-db xivo-libdao-python3

edit: if these packages are not in the latest version, then a second wazo-upgrade should fix it. Otherwise, the complete wazo-upgrade log will be necessary

thanks, I’ve tried a wazo-service restart before answering and a full reboot to be sure.

~# apt-cache policy wazo-call-logd xivo-manage-db xivo-libdao-python3
wazo-call-logd:
  Installé : 21.02~20210210.181610.6b3079e.deb10
  Candidat : 21.02~20210210.181610.6b3079e.deb10
 Table de version :
 *** 21.02~20210210.181610.6b3079e.deb10 500
        500 http://mirror.wazo.community/debian pelican-buster/main amd64 Packages
        100 /var/lib/dpkg/status
xivo-manage-db:
  Installé : 21.02~20210210.174547.cbfc4dc.deb10
  Candidat : 21.02~20210210.174547.cbfc4dc.deb10
 Table de version :
 *** 21.02~20210210.174547.cbfc4dc.deb10 500
        500 http://mirror.wazo.community/debian pelican-buster/main amd64 Packages
        100 /var/lib/dpkg/status
xivo-libdao-python3:
  Installé : 21.02~20210210.171032.f139bd1.deb10
  Candidat : 21.02~20210210.171032.f139bd1.deb10
 Table de version :
 *** 21.02~20210210.171032.f139bd1.deb10 500
        500 http://mirror.wazo.community/debian pelican-buster/main amd64 Packages
        100 /var/lib/dpkg/status

Well everything looks good to me :thinking:
Do you still have the error?

If so, what is the output of:

sudo -u postgres psql asterisk
> select * from alembic_version;
> \d call_log_participant

Do you still have the error?
argg yes.

asterisk=# select * from alembic_version;
 version_num  
--------------
 e5281e98b300
(1 row)

asterisk=# \d call_log_participant
                            Table "public.call_log_participant"
   Column    |           Type            | Collation | Nullable |          Default          
-------------+---------------------------+-----------+----------+---------------------------
 uuid        | character varying(38)     |           | not null | 
 call_log_id | integer                   |           |          | 
 user_uuid   | character varying(38)     |           | not null | 
 line_id     | integer                   |           |          | 
 role        | call_log_participant_role |           | not null | 
 tags        | character varying(128)[]  |           | not null | '{}'::character varying[]
Indexes:
    "call_log_participant_pkey" PRIMARY KEY, btree (uuid)
    "call_log_participant__idx__user_uuid" btree (user_uuid)
Foreign-key constraints:
    "fk_call_log_id" FOREIGN KEY (call_log_id) REFERENCES call_log(id) ON DELETE CASCADE

Did you remove answered column or change version_num value manually?
I guess the answer is no, but it’s really weird because this revision add this column. The way to have this revision is because this script has been executed successfully, which will add the answered column.

Anyways, you can fix it by manually add the answered column

sudo -u postgres psql asterisk
> ALTER TABLE call_log_participant ADD COLUMN answered BOOLEAN NOT NULL DEFAULT 'false';

Just to be sure everything else is ok, can you show the output of:

> SELECT wazo_version FROM infos;

For the next upgrade, you can verify wazo_version value to be sure that script has been executed correctly. The version will be bumped to 20.03

thank you !
it works now for wazo_version, was 21.01, I just updated manually by doing a update infos set wazo_version=‘21.02’; as I readed it in the alembic script.

What I understand is that database upgrade failed on wazo-upgrade because database was down.

That’s fine, the migration scripts were easy to redo manually :stuck_out_tongue:

In this case, the alembic version_num shouldn’t have been this version :thinking:, but yeah, maybe a random behavior :man_shrugging:
Your are fine, but keep monitoring this for the next upgrade :wink: