-- http://www.phpmyadmin.net
--




--
-- Database: `photocabine`
--

-- --------------------------------------------------------

--
-- Table structure for table `photocabine_status`
--


CREATE TABLE IF NOT EXISTS `photocabine_status` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` datetime NOT NULL,
  `device` int(11) NOT NULL,
  `config` varchar(100) NOT NULL,
  `needs_reboot` int(11) NOT NULL,
  `is_server_reachable` int(11) NOT NULL,
  `printer_status` varchar(20) NOT NULL,
  `printer_photos_remaining` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

ALTER TABLE photocabine_status modify printer_status varchar(20);

/*YB 20240128 : MySQL version is 5.6.17. It is too old to support 'ADD COLUMN IF NOT EXISTS'. The following statements fail: 
ALTER TABLE photocabine_status ADD COLUMN IF NOT EXISTS `ept_error_code` INT(11) NULL; 
ALTER TABLE photocabine_status ADD COLUMN IF NOT EXISTS `ept_error_code_hr` varchar(256) NULL; 
ALTER TABLE photocabine_status ADD COLUMN IF NOT EXISTS `payment_credit` int(11) NOT NULL DEFAULT 0; 
So I had to create photocabine_functions.sql to add required stored functions and procedure: column_exits, create_column_if_not_exists, drop_column_if_exists (bonus, just in case). 
*/

call create_column_if_not_exists('photocabine_status', 'ept_error_code', 'INT(11) NULL'); 
call create_column_if_not_exists('photocabine_status', 'ept_error_code_hr', 'VARCHAR(256) NULL');
call create_column_if_not_exists('photocabine_status', 'payment_credit', 'INT(11) NOT NULL DEFAULT 0');
call create_column_if_not_exists('photocabine_status', 'ept_date_telepar', 'datetime');
call create_column_if_not_exists('photocabine_status', 'ept_date_telecol', 'datetime');
call drop_column_if_exists('photocabine_status', 'paymode_cabin_sane');
call create_column_if_not_exists('photocabine_status', 'cabin_is_sane', 'INT(11) NOT NULL DEFAULT 0');

