
ALTER TABLE `_PresentatorPermissions` ADD `presentation_team_lock` DATETIME NOT NULL COMMENT 'datum in čas do kdaj lahko presentatorji vnesejo podatke' AFTER `presentation_team`;

ALTER TABLE `_PresentatorPermissions` ADD `deleted` TINYINT SET DEFAULT '0' AFTER `presentation_team_lock`;

ALTER TABLE `_visitStatistic` ADD `show_deposit` TINYINT NOT NULL AFTER `number_of_payments` ;

CREATE TABLE IF NOT EXISTS `_deliverer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `orderBy` int(11) NOT NULL,
  `deleted` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

ALTER TABLE `_visitStatistic` ADD `deliverer_id` INT NOT NULL ;

ALTER TABLE `_visitStatistic` ADD `delivery_amount_paid` TINYINT NOT NULL AFTER `delivery_finish_own_loan` ;


CREATE TABLE IF NOT EXISTS `_Permissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Description` text NOT NULL,
  `GroupId` int(11) NOT NULL,
  `Active` tinyint(4) NOT NULL,
  `Deleted` tinyint(4) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `_PermissionLink` (
  `permission_id` int(11) NOT NULL,
  `GroupId` int(11) NOT NULL,
  UNIQUE KEY `permission_id` (`permission_id`,`GroupId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `_PermissionLink` ADD `active` TINYINT NOT NULL 

ALTER TABLE `_PermissionLink` ADD `userType` TINYINT NOT NULL AFTER `GroupId` 

ALTER TABLE `_visitStatistic` ADD `add_payment_date` DATE NOT NULL ,
ADD `add_payment_comment` TEXT NOT NULL 




ALTER TABLE `_visitStatistic` ADD `month3Check` TINYINT NOT NULL ,
ADD `month9Check` TINYINT NOT NULL ,
ADD `month15Check` TINYINT NOT NULL 

ALTER TABLE `_WarpitConfig` CHANGE `cValue` `cValue` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL 

ALTER TABLE `_visitStatistic` ADD `month6Check` TINYINT NOT NULL AFTER `month3Check` 
ALTER TABLE `_visitStatistic` ADD `month6Check_date` DATE NOT NULL AFTER `month3Check_date` 

ALTER TABLE `_customerActivities` ADD `deleted` TINYINT NOT NULL

ALTER TABLE `_visitStatistic` CHANGE `avans_amount` `avans_amount` VARCHAR( 50 ) NOT NULL  

ALTER TABLE  `_visitStatistic` ADD  `avans_credit_amount` INT NOT NULL AFTER  `avans_amount` ,
ADD  `deposit_amount` INT NOT NULL AFTER  `avans_credit_amount`

ALTER TABLE `_visitStatistic` ADD `order_creator_id` VARCHAR( 20 ) NOT NULL 

ALTER TABLE `_visitStatistic` CHANGE `avans_amount` `avans_amount` FLOAT( 11 ) NOT NULL ,
CHANGE `avans_credit_amount` `avans_credit_amount` FLOAT( 11 ) NOT NULL ,
CHANGE `deposit_amount` `deposit_amount` FLOAT( 11 ) NOT NULL 

ALTER TABLE `_Cenik` CHANGE `id_loanCredit` `id_product` INT( 11 ) NOT NULL 
ALTER TABLE `_Cenik` CHANGE `datumOd` `dateFrom` DATE NOT NULL ,
CHANGE `datumDo` `dateTo` DATE NOT NULL 
ALTER TABLE `_Cenik` DROP `Cena` 

ALTER TABLE `_Cenik` ADD `comment` TEXT NOT NULL ,
ADD `active` TINYINT NOT NULL ,
ADD `deleted` TINYINT NOT NULL 

RENAME TABLE `Warpit_CRM`.`_Cenik` TO `Warpit_CRM`.`_loanCreditsIntervals` ;

ALTER TABLE `_visitStatistic` CHANGE `deposit_amount` `loanIntervalId` INT NOT NULL 