VERS='5.69.43'

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

isql - - <<EOT

DATABASE gc;

drop table at_marq;

create table at_marq 
  (
    code char(6),
    desig char(25)
  );

create unique index ix_marq01 on at_marq (code);

drop table gc_sav;

create table gc_sav 
  (
    code integer,
    nocli char(6),
    nomcl char(30),
    statut smallint,
    dtcre date,
    adres char(25),
    tel char(15),
    marq1 char(6),
    marq char(15),
    type1 smallint,
    type char(15),
    gsm char(15),
    noser char(20),
    art char(12),
    pxven float,
    garan smallint,
    pourc float,
    repar float,
    techn smallint,
    nomte char(25),
    strai smallint,
    nomst char(25),
    dtsor date,
    pann1 char(60),
    pann2 char(60),
    acce1 char(60),
    acce2 char(60),
    comm1 char(60),
    comm2 char(60),
    comm3 char(60),
    rev float,
    numdep smallint,
    newfac char(10),
    fachat char(10)
  );

create unique index ix_sav01 on gc_sav (code);

drop table gc_nosav;

create table gc_nosav 
  (
    num integer
  );

drop table gc_lsav;

create table gc_lsav 
  (
    numdos integer,
    num integer,
    code char(12),
    desig char(30),
    quant float,
    pxht float,
    pxrev float
  );

create unique index ix_lsav01 on gc_lsav (numdos,num);
   
CLOSE DATABASE;

EOT

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

echo "Mise a jour terminee"
