VERS='5.4.24'

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

isql - - <<EOT

database gc;

update gc_parsys set version='$VERS';

alter table gc_erc add (
  totalttc float,
  totaltva float
);
update gc_erc set
totalttc=0, totaltva=0
where totalttc is null;

alter table gc_vtraf add (fourn char(6));

create table gc_cffm 
  (
    code char(6),
    codfam char(4),
    mois smallint,
    annee smallint,
    qtt float,
    pxach float,
    rev float,
    pvt float,
    datcum date,
    numdep smallint,
    pvtnorm float,
    qttpr float,
    revpr float,
    pvtpr float
  );
create unique index ix_cffm01 on gc_cffm (code,codfam,mois,annee,numdep);

close database;

EOT

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

echo "Mise a jour terminee"

