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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}config`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}config` (
  `config_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `value` varchar(255) NOT NULL,
  PRIMARY KEY (`config_id`),
  UNIQUE KEY `id_UNIQUE` (`config_id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}reservation`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}reservation` (
  `reservation_id` int(11) NOT NULL AUTO_INCREMENT,
  `recorddate` datetime DEFAULT NULL,
  `tenancy_id` int(11) DEFAULT NULL,
  `tenant_id` int(11) DEFAULT NULL,
  `arrival_date` datetime DEFAULT NULL,
  `departure_date` datetime DEFAULT NULL,
  `lease_date` datetime DEFAULT NULL,
  `price` decimal(8,2) NOT NULL,
  `vat` decimal(8,2) DEFAULT NULL,
  `deposit` decimal(8,2) NOT NULL,
  `paid` tinyint(1) DEFAULT 0,
  `adults_nb` int(11) DEFAULT NULL,
  `childs_nb` int(11) DEFAULT NULL,
  `baby_nb` int(11) DEFAULT NULL,
  `status` int(11) DEFAULT NULL,
  `disabled` tinyint(1) DEFAULT 0,
  `comment` text DEFAULT '',
  `reference` varchar(45) DEFAULT '',
  PRIMARY KEY (`reservation_id`),
  UNIQUE KEY `reservation_id_UNIQUE` (`reservation_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}tenancy`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}tenancy` (
  `tenancy_id` int(11) NOT NULL AUTO_INCREMENT,
  `recorddate` datetime DEFAULT NULL,
  `name` varchar(45) DEFAULT '',
  `imagepath` varchar(255) DEFAULT 'no-image.jpg',
  `landlord_id` int(11) DEFAULT NULL,
  `address1` varchar(45) DEFAULT '',
  `address2` varchar(45) DEFAULT '',
  `zipcode` varchar(45) DEFAULT '',
  `city` varchar(45) DEFAULT '',
  `country` varchar(45) DEFAULT '',
  `state` varchar(45) DEFAULT '',
  `vat` decimal(8,2) DEFAULT NULL,
  `comment` varchar(255) DEFAULT '',
  `beds` int(11) DEFAULT NULL,
  `field1` text,
  PRIMARY KEY (`tenancy_id`),
  UNIQUE KEY `tenancy_id_UNIQUE` (`tenancy_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}tenant`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}tenant` (
  `tenant_id` int(11) NOT NULL AUTO_INCREMENT,
  `recorddate` datetime DEFAULT NULL,
  `enable` tinyint(1) DEFAULT NULL,
  `title` varchar(45) DEFAULT '',
  `name` varchar(45) DEFAULT '',
  `lastname` varchar(45) DEFAULT '',
  `address1` varchar(255) DEFAULT '',
  `address2` varchar(255) DEFAULT '',
  `zipcode` varchar(15) DEFAULT '',
  `city` varchar(45) DEFAULT '',
  `country` varchar(45) DEFAULT '',
  `phone` varchar(45) DEFAULT '',
  `cellphone` varchar(45) DEFAULT '',
  `fax` varchar(45) DEFAULT '',
  `email` varchar(45) DEFAULT '',
  `newsletter` tinyint(1) DEFAULT NULL,
  `language` varchar(45) DEFAULT '',
  `comment` varchar(255) DEFAULT '',
  `reference` varchar(45) DEFAULT '',
  PRIMARY KEY (`tenant_id`),
  UNIQUE KEY `id_UNIQUE` (`tenant_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}users`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT,
  `recorddate` datetime NOT NULL,
  `lastconnectdate` datetime NOT NULL,
  `enable` tinyint(1) DEFAULT NULL,
  `username` varchar(100) DEFAULT '',
  `password` varchar(200) DEFAULT '',
  `email` varchar(200) DEFAULT '',
  `comment` varchar(255) DEFAULT '',
  `resetid` varchar(255) DEFAULT '',
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `id_UNIQUE` (`user_id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}payment`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}payment` (
  `payment_id` int(11) NOT NULL AUTO_INCREMENT,
  `recorddate` datetime NOT NULL,
  `payment_date` datetime NOT NULL,
  `reservation_id` int(11) DEFAULT NULL,
  `method` varchar(255) DEFAULT NULL,
  `type` varchar(255) DEFAULT NULL,
  `amount` decimal(8,2) NOT NULL,
  `comment` text DEFAULT '',
  PRIMARY KEY (`payment_id`),
  UNIQUE KEY `id_UNIQUE` (`payment_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}leasecontent`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}leasecontent` (
  `leasecontent_id` int(11) NOT NULL AUTO_INCREMENT,
  `tenancy_id` int(11) DEFAULT NULL,
  `position` int(11) DEFAULT NULL,
  `header` varchar(255) DEFAULT '',
  `content` text DEFAULT '',
  `recorddate` datetime NOT NULL,
  PRIMARY KEY (`leasecontent_id`),
  UNIQUE KEY `id_UNIQUE` (`leasecontent_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

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

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}mail`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}mail` (
  `mail_id` int(11) NOT NULL AUTO_INCREMENT,
  `enable` tinyint(1) DEFAULT NULL,
  `tabid` int(11) NOT NULL,
  `description` varchar(255) DEFAULT '',
  `to` varchar(255) DEFAULT '',
  `cc` varchar(255) DEFAULT '',
  `bcc` varchar(255) DEFAULT '',
  `subject` varchar(255) DEFAULT '',
  `recorddate` datetime NOT NULL,
  `content` text DEFAULT '',
  PRIMARY KEY (`mail_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
-- Structure de la table `{DBNAME}`.`{TABLEPREFIX}mail`
--

CREATE TABLE IF NOT EXISTS `{DBNAME}`.`{TABLEPREFIX}tenancyfile` (
  `file_id` int(11) NOT NULL AUTO_INCREMENT,
  `recorddate` datetime NOT NULL,
  `tenancy_id` int(11) NOT NULL,
  `enable` tinyint(1) DEFAULT NULL,
  `name` varchar(45) NOT NULL,
  `filepath` varchar(255) DEFAULT NULL,
  `filetype` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`file_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'reserv_hour_enabled', '0');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'reserv_hour_increment', '15');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'reserv_hour_12HourFormat', '0');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'reserv_hour_mintime', '00:00');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'reserv_hour_maxtime', '00:00');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'reserv_reference', '');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'balance_reminder_delay', '30');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_cal_bgd', 'EDEDED');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_cal_free_bgd', 'D8E4BC');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_cal_free_txt', '000000');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_cal_option_bgd', 'FABF8F');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_cal_option_txt', '000000');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_cal_booked_bgd', 'DA9694');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_cal_booked_txt', '000000');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_na_bgd', 'C3C3C3');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_na_txt', '000000');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_medium_bgd', 'F7F3D5');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_medium_txt', '000000');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_high_bgd', 'C1D7EB');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_high_txt', '000000');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_tophigh_bgd', 'D0FEFE');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'color_season_tophigh_txt', '000000');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'userform_itemextra_count', '3');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'allow_edit_paid_reserv', '0');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'delete_backup_older_than', '180');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'delete_log_older_than', '180');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'tenant_reference', '');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'price_vat', '1');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'vat_list', '');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'tax_rate_children', '0');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'tax_rate_included', '1');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'invoice_with_vat', '0');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'invoice_with_tax', '0');
--
INSERT INTO `{DBNAME}`.`{TABLEPREFIX}config` (`config_id`, `name`, `value`) VALUES (NULL, 'balance_dateline', '30');