DROP VIEW IF EXISTS vn.promissoryNote;

ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_Vencimiento;
ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_Importe;
ALTER TABLE IF EXISTS vn2008.Pagares DROP INDEX empresa_id;
ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_empresa_id;
ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_id_proveedor;

ALTER TABLE IF EXISTS `vn2008`.`Pagares` RENAME `vn`.`promissoryNote`;

ALTER TABLE IF EXISTS `vn`.`promissoryNote`
CHANGE COLUMN IF EXISTS `Fechaemision` `issued` timestamp NOT NULL DEFAULT current_timestamp(),
CHANGE COLUMN IF EXISTS `Id_Pagare` `id` int(11) NOT NULL AUTO_INCREMENT FIRST,
CHANGE COLUMN IF EXISTS `Concepto` `Concept` varchar(50) DEFAULT NULL,
CHANGE COLUMN IF EXISTS `pago_id` `paymentFk` int(10) unsigned DEFAULT NULL;
