--
-- Host: localhost    Database: giftcard
-- ------------------------------------------------------


--
-- Table structure for table `login_attempts`
--

CREATE TABLE `login_attempts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ip_address` varchar(40) COLLATE utf8_bin NOT NULL,
  `login` varchar(50) COLLATE utf8_bin NOT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Table structure for table `purchase_item`
--

CREATE TABLE `purchase_item` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `purchase_id` int(11) DEFAULT NULL,
  `sender_first_name` varchar(100) NOT NULL,
  `sender_last_name` varchar(100) NOT NULL,
  `receiver_first_name` varchar(100) NOT NULL,
  `receiver_last_name` varchar(100) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `message` varchar(255) DEFAULT NULL,
  `barcode` varchar(11) NOT NULL,
  `amount` double NOT NULL,
  `send_on` date NOT NULL,
  `relayed_to_pos` tinyint(1) NOT NULL,
  `sent` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `barcode` (`barcode`),
  KEY `IDX_6FA8ED7D558FBEB9` (`purchase_id`),
  CONSTRAINT `FK_6FA8ED7D558FBEB9` FOREIGN KEY (`purchase_id`) REFERENCES `purchase` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

--
-- Table structure for table `purchase_item_view`
--

CREATE TABLE `purchase_item_view` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `purchase_item_id` int(11) NOT NULL,
  `ip` varchar(20) NOT NULL,
  `viewed` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_B3811DBE9B59827` (`purchase_item_id`),
  CONSTRAINT `FK_B3811DBE9B59827` FOREIGN KEY (`purchase_item_id`) REFERENCES `purchase_item` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Table structure for table `setting`
--

CREATE TABLE `setting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `increment` smallint(6) NOT NULL,
  `minimum` smallint(6) NOT NULL,
  `maximum` smallint(6) NOT NULL,
  `company_name` varchar(50) NOT NULL,
  `convenience_charge` double NOT NULL,
  `convenience_charge_type` varchar(10) NOT NULL,
  `tax` double NOT NULL,
  `notify_admins` varchar(200) NOT NULL,
  `domain` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

INSERT INTO setting (
	increment, 
	minimum, 
	maximum, 
	company_name, 
	convenience_charge, 
	convenience_charge_type, 
	tax, 
	notify_admins, 
	domain) VALUE (5, 20, 500, 'NailBox Salon & Spa, LLC', 2, 'flat rate', 0, 'support@thenail-box.com', 'nailboxpos');

--
-- Table structure for table `user_autologin`
--

CREATE TABLE `user_autologin` (
  `key_id` char(32) COLLATE utf8_bin NOT NULL,
  `user_id` int(11) NOT NULL DEFAULT '0',
  `user_agent` varchar(150) COLLATE utf8_bin NOT NULL,
  `last_ip` varchar(40) COLLATE utf8_bin NOT NULL,
  `last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`key_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Table structure for table `user_profiles`
--

CREATE TABLE `user_profiles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `country` varchar(20) COLLATE utf8_bin DEFAULT NULL,
  `website` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
	


