#alter table tbluserright drop primary key;
#alter table tbluserright drop key npart;
#alter table tbluserright drop key nmodule;
#alter table tbluserright add unique (nuserid, nmodule, npart);
#alter table tbluserright add column id int primary key auto_increment first;

#create table tblcustomer_promotion(
#	id int primary key auto_increment,
#	customer_id int not null,
#	printed_bags_big int not null default 0,
#	printed_bags_small int not null default 0,
#	basic_bags_big int not null default 0,
#	basic_bags_small int not null default 0,
#	notebook int not null default 0,
#	key_ring int not null default 0,
#	shopper int not null default 0,
#	bags_big int not null default 0,
#	photo_set int not null default 0,
#	display int not null default 0,
#	logo int not null default 0,
#	banner int not null default 0,
#	cube int not null default 0,
#	pen int not null default 0,
#	foreign key (customer_id) references tblcustomer(ncustomerid) on delete cascade on update cascade
#) engine = innodb character set utf8;

#alter table tblperson add column phone varchar(15);
#alter table tblcustomer add column second_contact_person_id int after npersonid;
#alter table tblcustomer add foreign key (second_contact_person_id) references tblperson(npersonid) on delete cascade on update cascade;

#alter table tblcustomer drop column nsfeerphoto;
#alter table tblcustomer drop column nbags;

#alter table tblcustomer change cincasso cincasso varchar(100);

#alter table `tblcustomer_locate` drop foreign key `tblcustomer_locate_ncustimerid`;
#alter table `tblcustomer_locate` drop foreign key `tblcustomer_locate_ibfk_1`;
#alter table tblcustomer_locate drop primary key;
#alter table tblcustomer_locate drop key `tblcustomer_locate_naddressid`;
#alter table tblcustomer_locate add column id int primary key auto_increment FIRST, add unique(ncustomerid, naddressid);
#alter table tblcustomer_locate add foreign key (ncustomerid) references tblcustomer(ncustomerid) on delete cascade on update cascade;
#alter table tblcustomer_locate add foreign key (naddressid) references tbladdress(naddressid) on delete cascade on update cascade;

#alter table tblcustomer change column cpassword cpassword varchar(32);
#alter table tblcontact add column second_email varchar(255) after cemail;
#alter table tblcustomer add column terms_accepted tinyint(1) default 0 not null;
#alter table tblcustomer_locate add column `type` char(1) default "v" after cname;
#alter table tblcustomer_locate change column `type` `type` char(1);

#alter table tblcustomer change column cpayreference cpayreference varchar(75);
#alter table tblcustomer change column ckvk ckvk varchar(25);

#alter table tblcustomer add column iban varchar(255) after cincasso;
#alter table tblcustomer add column bic varchar(255) after iban;
#alter table tblcustomer add column btw_number varchar(255) after bic;
#alter table tblcustomer change nsegment `nsegment` tinyint(4);

#alter table tblproduct_file drop foreign key tblproduct_file_nfileid;
#alter table `tblproduct_file` drop key tblproduct_file_nfileid;
#alter table tblproduct_file drop foreign key tblproduct_file_nproduct_seasonid;
#alter table tblproduct_file drop primary key;
#alter table tblproduct_file add column id int auto_increment primary key first;
#alter table tblproduct_file add foreign key (nfileid) references tblfile(nfileid) on delete cascade on update cascade;
#alter table tblproduct_file add foreign key (nproduct_seasonid) references `tblproduct_season`(nproduct_seasonid) on delete cascade on update cascade;

#ALTER TABLE tblproduct_season drop foreign key tblproduct_season_cproductid;

#ALTER TABLE tbladdress CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblagent CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblagent_shop CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblcategory CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblchange CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblcolor CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblcontact CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblcustomer CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblcustomer_label CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblcustomer_locate CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblcustomer_login CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE `tblcustomer_promotion` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbldownload CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblfile CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbllabel CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbllangmaster CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbllanguage CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblmail CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblnews CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblnewsphoto CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblorder CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblorderstatus CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblorderrow CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblorderrowstatus CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblperson CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblpricedeal CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproduct CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproduct_customer CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproduct_file CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproduct_property CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproduct_season CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproduct_sizecolor CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproductseason_shopprice CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblproperty CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblpublicmessage CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblquestion CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblquestion_answer CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblquestion_answers CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblquestion_website CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblseason CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblsettings CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblsfeerphoto CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblshop CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tblsize CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbltranslation CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbluser CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbluser_shop CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#ALTER TABLE tbluserright CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

#ALTER TABLE tblproduct_season add foreign key (cproductid) references tblproduct(cproductid) on delete cascade on update cascade;

#alter table tblnews add column `shop_id` tinyint(3) unsigned NOT NULL, add index news_shopid(shop_id);
#update tblnews set shop_id = 1;
#alter table tblnews add foreign key (shop_id) references tblshop(nshopid);

#alter table tblproduct_file drop foreign key tblproduct_file_nfileid;
#alter table `tblproduct_file` drop key tblproduct_file_nfileid;
#alter table tblproduct_file drop foreign key tblproduct_file_nproduct_seasonid;
#alter table tblproduct_file drop primary key;
#alter table tblproduct_file add column id int auto_increment primary key first;
#alter table tblproduct_file add foreign key (nfileid) references tblfile(nfileid) on delete cascade on update cascade;
#alter table tblproduct_file add foreign key (nproduct_seasonid) references `tblproduct_season`(nproduct_seasonid) on delete cascade on update cascade;

### tot hier gedaan op live, lokaal en test!! ###

#alter table tblshop add column label varchar(128) not null after cname;

# Om property overzicht goed te laten werken
#alter table tblproduct_property drop foreign key `FK_tblproduct_property_shopid`;
#alter table tblproduct_property drop foreign key `tblproduct_property_ibfk_1`;
#alter table tblproduct_property drop foreign key `tblproduct_property_npropertyid`;
#alter table tblproduct_property drop primary key;
#alter table tblproduct_property add column id int primary key auto_increment first;
#alter table tblproduct_property add foreign key (nproduct_seasonid) references tblproduct_season(nproduct_seasonid);
#alter table tblproduct_property add foreign key (npropertyid) references tblproperty(npropertyid);
#alter table tblproduct_property add foreign key (nshopid) references `tblshop`(nshopid);
#alter table tblproduct_property add unique `season_property_shop` (nproduct_seasonid, npropertyid, nshopid);

#alter table tblproductseason_shopprice drop foreign key FK_tblproductseason_shopprice_seasonid;
#alter table tblproductseason_shopprice drop foreign key FK_tblproductseason_shopprice_shop;
#alter table tblproductseason_shopprice drop primary key;
#alter table tblproductseason_shopprice drop key FK_tblproductseason_shopprice_shop;
#alter table tblproductseason_shopprice add column id int primary key auto_increment FIRST;
#alter table tblproductseason_shopprice add foreign key (`nproduct_seasonid`) REFERENCES `tblproduct_season` (`nproduct_seasonid`);
#alter table tblproductseason_shopprice add foreign key (`nshopid`) REFERENCES `tblshop` (`nshopid`);

alter table tblproductseason_shopprice add unique index (nproduct_seasonid, nshopid);