#268


# ---------------------------------------------------------------------- #
# Add table "ARTICOLO_CLIENTE"                                           #
# ---------------------------------------------------------------------- #

CREATE TABLE `ARTICOLO_CLIENTE` (
    `id_articoloCliente` INTEGER NOT NULL AUTO_INCREMENT,
    `id_clifor` INTEGER,
    `id_articolo` INTEGER,
    `id_articoloVariante` INTEGER,
    `id_tipo` INTEGER(11),
    CONSTRAINT `PK_ARTICOLO_CLIENTE` PRIMARY KEY (`id_articoloCliente`)
);

# ---------------------------------------------------------------------- #
# Add foreign key constraints                                            #
# ---------------------------------------------------------------------- #

ALTER TABLE `ARTICOLO_CLIENTE` ADD CONSTRAINT `ARTICOLO_ARTICOLO_CLIENTE` 
    FOREIGN KEY (`id_articolo`) REFERENCES `ARTICOLO` (`id_articolo`);

ALTER TABLE `ARTICOLO_CLIENTE` ADD CONSTRAINT `ARTICOLO_VARIANTE_ARTICOLO_CLIENTE` 
    FOREIGN KEY (`id_articoloVariante`) REFERENCES `ARTICOLO_VARIANTE` (`id_articoloVariante`);

ALTER TABLE `ARTICOLO_CLIENTE` ADD CONSTRAINT `TIPO_ARTICOLO_CLIENTE` 
    FOREIGN KEY (`id_tipo`) REFERENCES `TIPO` (`id_tipo`);

ALTER TABLE `ARTICOLO_CLIENTE` ADD CONSTRAINT `CLIFOR_ARTICOLO_CLIENTE` 
    FOREIGN KEY (`id_clifor`) REFERENCES `CLIFOR` (`id_clifor`);
	
	
	ALTER TABLE `ARTICOLO_CLIENTE` ADD COLUMN `indiciTipo` VARCHAR(1000);
	
	######################################################################
#insert into PARM (codice) values ('DB_VERSION');
UPDATE PARM SET testo='268' where codice='DB_VERSION';
######################################################################
##270

# ---------------------------------------------------------------------- #
# Alter table "ARTICOLO"                                                 #
# ---------------------------------------------------------------------- #

ALTER TABLE `ARTICOLO` ADD COLUMN `qtaSuEbay` INTEGER;

ALTER TABLE `ARTICOLO` ADD COLUMN `impression` INTEGER;

ALTER TABLE `ARTICOLO` ADD COLUMN `tmstLastImpression` DATETIME;

# ---------------------------------------------------------------------- #
# Alter table "ARTICOLO_VARIANTE"                                        #
# ---------------------------------------------------------------------- #

ALTER TABLE `ARTICOLO_VARIANTE` ADD COLUMN `qtaSuEbayAv` INTEGER;

ALTER TABLE `ARTICOLO_VARIANTE` ADD COLUMN `impressionAv` INTEGER;

ALTER TABLE `ARTICOLO_VARIANTE` ADD COLUMN `tmstLastImpressionAv` DATETIME;

# ---------------------------------------------------------------------- #

ALTER TABLE `TIPO_PAGAMENTO` ADD COLUMN `percWwwSconto` DECIMAL(5,2);

ALTER TABLE `TIPO_PAGAMENTO` ADD COLUMN `percWwwCommissione` DECIMAL(5,2);



	######################################################################
#insert into PARM (codice) values ('DB_VERSION');
UPDATE PARM SET testo='270' where codice='DB_VERSION';
######################################################################



#271

# ---------------------------------------------------------------------- #
# Alter table "TIPO_PAGAMENTO"                                           #
# ---------------------------------------------------------------------- #

#ALTER TABLE `TIPO_PAGAMENTO` ADD COLUMN `percWwwSconto` DECIMAL(5,2);

#ALTER TABLE `TIPO_PAGAMENTO` ADD COLUMN `percWwwCommissione` DECIMAL(5,2);



	######################################################################
#insert into PARM (codice) values ('DB_VERSION');
UPDATE PARM SET testo='271' where codice='DB_VERSION';
######################################################################


##272

ALTER TABLE `ARTICOLO` ADD COLUMN `qtaMaxAcquistoWww` INTEGER;


	######################################################################
#insert into PARM (codice) values ('DB_VERSION');
UPDATE PARM SET testo='272' where codice='DB_VERSION';
######################################################################




##273

# ---------------------------------------------------------------------- #
# Alter table "ARTICOLO_FORNITORE"                                       #
# ---------------------------------------------------------------------- #

ALTER TABLE `ARTICOLO_FORNITORE` ADD COLUMN `costoAggiuntivo` DECIMAL(18,4);


	######################################################################
#insert into PARM (codice) values ('DB_VERSION');
UPDATE PARM SET testo='273' where codice='DB_VERSION';
######################################################################


##274
alter table BLACKLIST add column ipMax integer unsigned;
alter table BLACKLIST add column ipMin integer unsigned;


#####################################################################
#insert into PARM (codice) values ('DB_VERSION');
UPDATE PARM SET testo='274' where codice='DB_VERSION';
######################################################################


