VERS='5.68.75'

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_cmd ADD (
    numstade smallint,
    dtstade date,
    notreref char(30),
    rem char(30),
    votreref char(30),
    usercreat char(8),
    autorise char(8),
    kreffac char(15),
    kcolis char(18),
    kbor char(12),
    typfac smallint,
    idadliv smallint,
    idadfac smallint,
    traite smallint,
    typexp smallint
);

UPDATE gc_cmd SET
    numstade=0,
    dtstade=dteta,
    typfac=0,
    idadliv=0,
    idadfac=0,
    traite=0,
    typexp=0
WHERE numstade IS NULL;

CLOSE DATABASE;

EOT

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

echo "Mise a jour terminee"
