-- how to add a field
if not exists( select * from #fields where table_name = '$TableName' and Field_Name='InfoKunde'  )
    then ALTER TABLE $TableName ADD COLUMN InfoKunde BOOLEAN DEFAULT FALSE DESCRIPTION 'Info Kunde';
end if;

if not exists( select * from #fields where table_name = '$TableName' and Field_Name='ShopKunde'  )
    then ALTER TABLE $TableName ADD COLUMN ShopKunde BOOLEAN DEFAULT FALSE DESCRIPTION 'Kunde aus dem Webshop';
end if;

if not exists( select * from #fields where table_name = '$TableName' and Field_Name='ShopNeuKunde'  )
    then ALTER TABLE $TableName ADD COLUMN ShopNeuKunde BOOLEAN DEFAULT FALSE DESCRIPTION 'Neuer Kunde aus dem Webshop';
end if;

if not exists( select * from #fields where table_name = '$TableName' and Field_Name='ShopAnmeldung'  )
    then ALTER TABLE $TableName ADD COLUMN ShopAnmeldung DATE DEFAULT NULL DESCRIPTION 'Datum des Imports';
end if;

if not exists( select * from #fields where table_name = '$TableName' and Field_Name='ShopUpdateImport'  )
    then ALTER TABLE $TableName ADD COLUMN ShopUpdateImport DATE DEFAULT NULL DESCRIPTION 'Datum des letzten Imports';
end if;

if not exists( select * from #fields where table_name = '$TableName' and Field_Name='ShopKundenNr'  )
    then ALTER TABLE $TableName ADD COLUMN ShopKundenNr SHORTSTRING(80) DEFAULT '' DESCRIPTION 'Kundennummer aus dem Webshop';
end if;
-- how to drop a field
--if exists( select * from #fields where table_name = '$TableName' and Field_Name='neuerShopArtikel'  )
--   then ALTER TABLE $TableName DROP COLUMN neuerShopArtikel ;
--end if;

