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




--
-- Database: `subscription_manager`
--

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

--
-- Table structure for table `billing_frequencies`
--

CREATE TABLE IF NOT EXISTS `billing_frequencies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;

--
-- Dumping data for table `billing_frequencies`
--

INSERT INTO `billing_frequencies` (`id`, `description`) VALUES
(1, 'free'),
(2, 'once_off'),
(3, 'daily'),
(4, 'daily_(first_day_free)'),
(5, 'weekly'),
(6, 'weekly_(first_day_free)'),
(7, 'monthly');

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

--
-- Table structure for table `billing_statusses`
--

CREATE TABLE IF NOT EXISTS `billing_statusses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `billing_statusses`
--

INSERT INTO `billing_statusses` (`id`, `status`) VALUES
(1, 'success'),
(2, 'insufficient_funds');

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

--
-- Table structure for table `content_types`
--

CREATE TABLE IF NOT EXISTS `content_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `content_types`
--

INSERT INTO `content_types` (`id`, `type`) VALUES
(1, 'SMS'),
(2, 'WAP'),
(3, 'IMAGES'),
(4, 'VIDEOS'),
(5, 'MUSIC');

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

--
-- Table structure for table `migrations`
--

CREATE TABLE IF NOT EXISTS `migrations` (
  `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2014_10_12_000000_create_users_table', 1),
('2014_10_12_100000_create_password_resets_table', 1);

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

--
-- Table structure for table `operators`
--

CREATE TABLE IF NOT EXISTS `operators` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operator` varchar(50) NOT NULL,
  `vendor_id` varchar(50) NOT NULL,
  `gateway_endpoint` varchar(200) NOT NULL,
  `gateway_endpoint_port` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `operators`
--

INSERT INTO `operators` (`id`, `operator`, `vendor_id`, `gateway_endpoint`, `gateway_endpoint_port`) VALUES
(1, 'imi_mobile', 'Managed Mobile Services (Pty) Ltd.', 'loki.365.co.za', 9480);

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

--
-- Table structure for table `operator_services`
--

CREATE TABLE IF NOT EXISTS `operator_services` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operator_id` int(11) NOT NULL,
  `service_id` int(11) NOT NULL,
  `operator_service_id` varchar(100) NOT NULL,
  `chron_expression` varchar(50) NOT NULL,
  `active` int(1) NOT NULL,
  `start_date` timestamp NULL DEFAULT NULL,
  `end_date` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `operator_id` (`operator_id`),
  KEY `operator_service_id` (`operator_service_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `operator_services`
--

INSERT INTO `operator_services` (`id`, `operator_id`, `service_id`, `operator_service_id`, `chron_expression`, `active`, `start_date`, `end_date`) VALUES
(1, 1, 1, 'Check What IMI Gives Us', '0 45 13 1/1 * ? *', 1, '2015-11-13 10:05:11', '2015-11-20 08:05:11');

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

--
-- Table structure for table `price_points`
--

CREATE TABLE IF NOT EXISTS `price_points` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `rate` decimal(11,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `price_points`
--

INSERT INTO `price_points` (`id`, `rate`) VALUES
(1, 0.50),
(2, 1.00),
(3, 2.00),
(4, 3.00),
(5, 4.00),
(6, 5.00);

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

--
-- Table structure for table `retry_policies`
--

CREATE TABLE IF NOT EXISTS `retry_policies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `max_retries` int(11) NOT NULL,
  `delay_minutes` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `retry_policies`
--

INSERT INTO `retry_policies` (`id`, `name`, `max_retries`, `delay_minutes`) VALUES
(1, 'test', 4, 100);

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

--
-- Table structure for table `services`
--

CREATE TABLE IF NOT EXISTS `services` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `content_type_id` int(11) NOT NULL,
  `price_point_id` int(11) NOT NULL,
  `billing_frequency_id` int(11) NOT NULL,
  `retry_policy_id` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `content_type_id` (`content_type_id`),
  KEY `price_point_id` (`price_point_id`),
  KEY `billing_frequency_id` (`billing_frequency_id`),
  KEY `retry_policy_id` (`retry_policy_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `services`
--

INSERT INTO `services` (`id`, `name`, `content_type_id`, `price_point_id`, `billing_frequency_id`, `retry_policy_id`, `created_at`, `updated_at`) VALUES
(1, 'test', 1, 1, 3, 1, '2015-10-16 15:05:15', '2015-10-16 15:05:15');

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

--
-- Table structure for table `subscribers`
--

CREATE TABLE IF NOT EXISTS `subscribers` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `customer_id` bigint(20) NOT NULL,
  `emsisdn` bigint(20) NOT NULL,
  `service_id` int(11) NOT NULL,
  `operator_id` int(11) NOT NULL,
  `subscriber_status_id` int(11) NOT NULL,
  `start_date` timestamp NULL DEFAULT NULL,
  `end_date` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `customer_id` (`customer_id`),
  KEY `service_id` (`service_id`),
  KEY `subscriber_status_id` (`subscriber_status_id`),
  KEY `start_date` (`start_date`),
  KEY `end_date` (`end_date`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `subscribers`
--

INSERT INTO `subscribers` (`id`, `customer_id`, `emsisdn`, `service_id`, `operator_id`, `subscriber_status_id`, `start_date`, `end_date`, `created_at`, `updated_at`) VALUES
(3, 141, 985068746, 1, 1, 1, '2016-02-08 08:06:14', NULL, '2015-10-29 10:05:11', '2016-02-08 08:06:14');

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

--
-- Table structure for table `subscriber_statuses`
--

CREATE TABLE IF NOT EXISTS `subscriber_statuses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `subscriber_statuses`
--

INSERT INTO `subscriber_statuses` (`id`, `status`) VALUES
(1, 'active'),
(2, 'suspended'),
(3, 'unsubscribed');

