VERS='5.68.20'

echo "Mise a jour de la base de donnees pour Version $VERS"

isql - - <<EOT

DATABASE gc;

UPDATE 
  gc_parsys 
SET 
  version='$VERS'
WHERE
  version<'$VERS';

ALTER TABLE
  gc_parsys
ADD
(
    nomdep20 char(8),
    nomdep21 char(8),
    nomdep22 char(8),
    nomdep23 char(8),
    nomdep24 char(8),
    nomdep25 char(8),
    nomdep26 char(8),
    nomdep27 char(8),
    nomdep28 char(8),
    nomdep29 char(8),
    nomdep30 char(8),
    nomdep31 char(8),
    nomdep32 char(8),
    nomdep33 char(8),
    nomdep34 char(8),
    nomdep35 char(8),
    nomdep36 char(8),
    nomdep37 char(8),
    nomdep38 char(8),
    nomdep39 char(8),
    iddep20 smallint,
    iddep21 smallint,
    iddep22 smallint,
    iddep23 smallint,
    iddep24 smallint,
    iddep25 smallint,
    iddep26 smallint,
    iddep27 smallint,
    iddep28 smallint,
    iddep29 smallint,
    iddep30 smallint,
    iddep31 smallint,
    iddep32 smallint,
    iddep33 smallint,
    iddep34 smallint,
    iddep35 smallint,
    iddep36 smallint,
    iddep37 smallint,
    iddep38 smallint,
    iddep39 smallint,
    numsoc20 smallint,
    numsoc21 smallint,
    numsoc22 smallint,
    numsoc23 smallint,
    numsoc24 smallint,
    numsoc25 smallint,
    numsoc26 smallint,
    numsoc27 smallint,
    numsoc28 smallint,
    numsoc29 smallint,
    numsoc30 smallint,
    numsoc31 smallint,
    numsoc32 smallint,
    numsoc33 smallint,
    numsoc34 smallint,
    numsoc35 smallint,
    numsoc36 smallint,
    numsoc37 smallint,
    numsoc38 smallint,
    numsoc39 smallint,
    grpdep20 smallint,
    grpdep21 smallint,
    grpdep22 smallint,
    grpdep23 smallint,
    grpdep24 smallint,
    grpdep25 smallint,
    grpdep26 smallint,
    grpdep27 smallint,
    grpdep28 smallint,
    grpdep29 smallint,
    grpdep30 smallint,
    grpdep31 smallint,
    grpdep32 smallint,
    grpdep33 smallint,
    grpdep34 smallint,
    grpdep35 smallint,
    grpdep36 smallint,
    grpdep37 smallint,
    grpdep38 smallint,
    grpdep39 smallint,
    clicmpt20 char(6),
    clicmpt21 char(6),
    clicmpt22 char(6),
    clicmpt23 char(6),
    clicmpt24 char(6),
    clicmpt25 char(6),
    clicmpt26 char(6),
    clicmpt27 char(6),
    clicmpt28 char(6),
    clicmpt29 char(6),
    clicmpt30 char(6),
    clicmpt31 char(6),
    clicmpt32 char(6),
    clicmpt33 char(6),
    clicmpt34 char(6),
    clicmpt35 char(6),
    clicmpt36 char(6),
    clicmpt37 char(6),
    clicmpt38 char(6),
    clicmpt39 char(6),
    clicess20 char(6),
    clicess21 char(6),
    clicess22 char(6),
    clicess23 char(6),
    clicess24 char(6),
    clicess25 char(6),
    clicess26 char(6),
    clicess27 char(6),
    clicess28 char(6),
    clicess29 char(6),
    clicess30 char(6),
    clicess31 char(6),
    clicess32 char(6),
    clicess33 char(6),
    clicess34 char(6),
    clicess35 char(6),
    clicess36 char(6),
    clicess37 char(6),
    clicess38 char(6),
    clicess39 char(6)
);

ALTER TABLE
  gc_soc
ADD
(
    comptana20 char(8),
    comptana21 char(8),
    comptana22 char(8),
    comptana23 char(8),
    comptana24 char(8),
    comptana25 char(8),
    comptana26 char(8),
    comptana27 char(8),
    comptana28 char(8),
    comptana29 char(8),
    comptana30 char(8),
    comptana31 char(8),
    comptana32 char(8),
    comptana33 char(8),
    comptana34 char(8),
    comptana35 char(8),
    comptana36 char(8),
    comptana37 char(8),
    comptana38 char(8),
    comptana39 char(8),
    lastpont20 date,
    lastpont21 date,
    lastpont22 date,
    lastpont23 date,
    lastpont24 date,
    lastpont25 date,
    lastpont26 date,
    lastpont27 date,
    lastpont28 date,
    lastpont29 date,
    lastpont30 date,
    lastpont31 date,
    lastpont32 date,
    lastpont33 date,
    lastpont34 date,
    lastpont35 date,
    lastpont36 date,
    lastpont37 date,
    lastpont38 date,
    lastpont39 date,
    seekpont20 integer,
    seekpont21 integer,
    seekpont22 integer,
    seekpont23 integer,
    seekpont24 integer,
    seekpont25 integer,
    seekpont26 integer,
    seekpont27 integer,
    seekpont28 integer,
    seekpont29 integer,
    seekpont30 integer,
    seekpont31 integer,
    seekpont32 integer,
    seekpont33 integer,
    seekpont34 integer,
    seekpont35 integer,
    seekpont36 integer,
    seekpont37 integer,
    seekpont38 integer,
    seekpont39 integer,
    fourcess20 char(6),
    fourcess21 char(6),
    fourcess22 char(6),
    fourcess23 char(6),
    fourcess24 char(6),
    fourcess25 char(6),
    fourcess26 char(6),
    fourcess27 char(6),
    fourcess28 char(6),
    fourcess29 char(6),
    fourcess30 char(6),
    fourcess31 char(6),
    fourcess32 char(6),
    fourcess33 char(6),
    fourcess34 char(6),
    fourcess35 char(6),
    fourcess36 char(6),
    fourcess37 char(6),
    fourcess38 char(6),
    fourcess39 char(6),
    achcess20 char(8),
    achcess21 char(8),
    achcess22 char(8),
    achcess23 char(8),
    achcess24 char(8),
    achcess25 char(8),
    achcess26 char(8),
    achcess27 char(8),
    achcess28 char(8),
    achcess29 char(8),
    achcess30 char(8),
    achcess31 char(8),
    achcess32 char(8),
    achcess33 char(8),
    achcess34 char(8),
    achcess35 char(8),
    achcess36 char(8),
    achcess37 char(8),
    achcess38 char(8),
    achcess39 char(8)
);

CLOSE DATABASE;

EOT

chmod 666 $DBPATH/gc.dbs/*.idx
chmod 666 $DBPATH/gc.dbs/*.dat

echo "Mise a jour terminee"
