-- https://www.phpmyadmin.net/
--


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

--
-- Table structure for table `logs`
--

CREATE TABLE `logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `old_data` text COLLATE utf8mb4_unicode_ci,
  `new_data` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `method` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `ip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `agent` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `logs`
--

INSERT INTO `logs` (`id`, `subject`, `old_data`, `new_data`, `url`, `method`, `ip`, `agent`, `slug`, `created_at`, `updated_at`) VALUES
(21, 'Sweepstake created', '', 'a:8:{s:4:\"name\";s:15:\"test sweepstake\";s:7:\"program\";s:13:\"gemzone-abuja\";s:17:\"number_of_winners\";s:1:\"3\";s:10:\"start_date\";s:19:\"2020-02-27 15:08:44\";s:8:\"end_date\";s:19:\"2020-02-28 15:08:44\";s:8:\"win_once\";s:1:\"1\";s:15:\"start_ticket_no\";s:3:\"200\";s:4:\"slug\";s:15:\"test-sweepstake\";}', 'http://localhost:8000/api/v1/sweepstake/create', 'POST', '::1', 'PostmanRuntime/7.21.0', 'test-sweepstake', '2020-05-06 06:50:20', '2020-05-06 06:50:20'),
(22, 'Sweepstake Updated', 'O:8:\"stdClass\":12:{s:4:\"name\";s:15:\"test sweepstake\";s:4:\"slug\";s:15:\"test-sweepstake\";s:7:\"program\";s:13:\"gemzone-abuja\";s:8:\"win_once\";i:1;s:10:\"start_date\";s:19:\"2020-02-27 15:08:44\";s:8:\"end_date\";s:19:\"2020-02-28 15:08:44\";s:15:\"start_ticket_no\";i:200;s:6:\"status\";i:1;s:17:\"number_of_winners\";i:3;s:9:\"is_extend\";i:0;s:10:\"created_at\";s:19:\"2020-05-06 06:50:20\";s:10:\"updated_at\";s:19:\"2020-05-06 06:50:20\";}', 'a:1:{s:4:\"name\";s:7:\"GemZone\";}', 'http://localhost:8000/api/v1/sweepstake/update/test-sweepstake?name=GemZone', 'PUT', '::1', 'PostmanRuntime/7.21.0', 'test-sweepstake', '2020-05-06 07:15:22', '2020-05-06 07:15:22'),
(23, 'Sweepstake Disabled', 'O:8:\"stdClass\":12:{s:4:\"name\";s:7:\"GemZone\";s:4:\"slug\";s:15:\"test-sweepstake\";s:7:\"program\";s:13:\"gemzone-abuja\";s:8:\"win_once\";i:1;s:10:\"start_date\";s:19:\"2020-02-27 15:08:44\";s:8:\"end_date\";s:19:\"2020-02-28 15:08:44\";s:15:\"start_ticket_no\";i:200;s:6:\"status\";i:1;s:17:\"number_of_winners\";i:3;s:9:\"is_extend\";i:0;s:10:\"created_at\";s:19:\"2020-05-06 06:50:20\";s:10:\"updated_at\";s:19:\"2020-05-06 07:15:22\";}', 'a:1:{s:6:\"status\";i:2;}', 'http://localhost:8000/api/v1/disable/sweepstake/test-sweepstake', 'GET', '::1', 'PostmanRuntime/7.21.0', 'test-sweepstake', '2020-05-06 07:16:58', '2020-05-06 07:16:58'),
(24, 'Sweepstake Enabled', 'O:8:\"stdClass\":12:{s:4:\"name\";s:7:\"GemZone\";s:4:\"slug\";s:15:\"test-sweepstake\";s:7:\"program\";s:13:\"gemzone-abuja\";s:8:\"win_once\";i:1;s:10:\"start_date\";s:19:\"2020-02-27 15:08:44\";s:8:\"end_date\";s:19:\"2020-02-28 15:08:44\";s:15:\"start_ticket_no\";i:200;s:6:\"status\";i:2;s:17:\"number_of_winners\";i:3;s:9:\"is_extend\";i:0;s:10:\"created_at\";s:19:\"2020-05-06 06:50:20\";s:10:\"updated_at\";s:19:\"2020-05-06 07:16:58\";}', 'a:1:{s:6:\"status\";i:1;}', 'http://localhost:8000/api/v1/restore/sweepstake/test-sweepstake', 'GET', '::1', 'PostmanRuntime/7.21.0', 'test-sweepstake', '2020-05-06 07:17:37', '2020-05-06 07:17:37'),
(25, 'Sweepstake Extended', 'O:8:\"stdClass\":12:{s:4:\"name\";s:7:\"GemZone\";s:4:\"slug\";s:15:\"test-sweepstake\";s:7:\"program\";s:13:\"gemzone-abuja\";s:8:\"win_once\";i:1;s:10:\"start_date\";s:19:\"2020-02-27 15:08:44\";s:8:\"end_date\";s:19:\"2020-02-28 15:08:44\";s:15:\"start_ticket_no\";i:200;s:6:\"status\";i:1;s:17:\"number_of_winners\";i:3;s:9:\"is_extend\";i:0;s:10:\"created_at\";s:19:\"2020-05-06 06:50:20\";s:10:\"updated_at\";s:19:\"2020-05-06 07:17:37\";}', 'a:3:{s:9:\"is_extend\";i:1;s:10:\"start_date\";s:19:\"2020-06-17 12:13:16\";s:8:\"end_date\";s:19:\"2020-06-20 12:13:16\";}', 'http://localhost:8000/api/v1/extend/sweepstake/test-sweepstake?end_date=2020-06-20%2012%3A13%3A16&start_date=2020-06-17%2012%3A13%3A16', 'PUT', '::1', 'PostmanRuntime/7.21.0', 'test-sweepstake', '2020-05-06 07:17:59', '2020-05-06 07:17:59'),
(26, 'Added Prizes', '', 'a:4:{s:10:\"prize_name\";s:7:\"iphoneX\";s:14:\"prize_position\";s:14:\"first position\";s:10:\"sweepstake\";s:15:\"test-sweepstake\";s:4:\"slug\";s:14:\"first-position\";}', 'http://localhost:8000/api/v1/prizes/create', 'POST', '::1', 'PostmanRuntime/7.21.0', 'test-sweepstake', '2020-05-06 08:53:46', '2020-05-06 08:53:46'),
(27, 'Prize Update', 'O:29:\"Illuminate\\Support\\Collection\":1:{s:8:\"\0*\0items\";a:1:{i:0;O:8:\"stdClass\":5:{s:10:\"prize_name\";s:7:\"iphoneX\";s:4:\"slug\";s:14:\"first-position\";s:14:\"prize_position\";s:14:\"first position\";s:10:\"sweepstake\";s:15:\"test-sweepstake\";s:6:\"status\";i:1;}}}', 'a:1:{s:10:\"prize_name\";s:7:\"iphonex\";}', 'http://localhost:8000/api/v1/prizes/test-sweepstake/first-position?prize_name=iphonex', 'PUT', '::1', 'PostmanRuntime/7.21.0', 'first-position', '2020-05-06 10:53:30', '2020-05-06 10:53:30'),
(28, 'Prize Disabled', 'b:1;', 'a:1:{s:6:\"status\";i:2;}', 'http://localhost:8000/api/v1/disable/prize/first-position', 'GET', '::1', 'PostmanRuntime/7.21.0', 'first-position', '2020-05-06 11:02:40', '2020-05-06 11:02:40'),
(29, 'Prize Enabled', 'b:1;', 'a:1:{s:6:\"status\";i:1;}', 'http://localhost:8000/api/v1/restore/prize/first-position', 'GET', '::1', 'PostmanRuntime/7.21.0', 'first-position', '2020-05-06 11:30:25', '2020-05-06 11:30:25'),
(30, 'Sweepstake created', '', 'a:9:{s:4:\"name\";s:15:\"test sweepstake\";s:7:\"program\";s:13:\"gemzone-abuja\";s:17:\"number_of_winners\";s:1:\"3\";s:10:\"start_date\";s:19:\"2020-02-27 15:08:44\";s:8:\"end_date\";s:19:\"2020-02-28 15:08:44\";s:8:\"win_once\";s:1:\"1\";s:15:\"start_ticket_no\";s:3:\"200\";s:4:\"slug\";s:14:\"SWP1vDVFJOymFz\";s:13:\"ticket_prefix\";s:2:\"TS\";}', 'http://localhost:8000/api/v1/sweepstake/create', 'POST', '::1', 'PostmanRuntime/7.21.0', 'SWP1vDVFJOymFz', '2020-07-21 11:44:39', '2020-07-21 11:44:39');

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

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

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2020_04_08_232953_create_sweepstakes_table', 1),
(2, '2020_04_09_094028_create_prize_table', 1),
(3, '2020_04_09_094357_create_tickets_table', 1),
(4, '2020_04_09_094659_create_winners_table', 1),
(5, '2020_04_10_073446_add_no_of_winners_to_sweepstakes_table', 2),
(6, '2020_04_10_113129_create_logs_table', 3),
(7, '2020_04_13_140214_add_sst_id_to_winners_table', 4),
(8, '2020_04_16_161706_create_programs_table', 5),
(9, '2020_04_17_142552_add_token_to_programs_table', 6),
(10, '2020_04_18_205456_add_slug_to_programs_table', 7),
(11, '2020_04_18_210150_add_status_to_programs_table', 8),
(12, '2020_04_18_213139_add_uuid_to_programs_table', 9),
(13, '2020_04_20_005437_add_sweepstake_slug_to_sweepstakes', 10),
(14, '2020_04_22_200841_add_prize_slug_to_prize', 11);

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

--
-- Table structure for table `prize`
--

CREATE TABLE `prize` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `prize_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `prize_position` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sweepstake_id` bigint(20) NOT NULL,
  `status` int(10) NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `slug` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `prize`
--

INSERT INTO `prize` (`id`, `prize_name`, `prize_position`, `sweepstake_id`, `status`, `created_at`, `updated_at`, `slug`) VALUES
(1, 'iphonex', 'first position', 0, 1, '2020-05-06 08:53:46', '2020-05-06 11:30:25', 'first-position');

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

--
-- Table structure for table `rand_gen`
--

CREATE TABLE `rand_gen` (
  `id` bigint(20) NOT NULL,
  `name` varchar(191) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `rand_gen`
--

INSERT INTO `rand_gen` (`id`, `name`) VALUES
(1, 'test');

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

--
-- Table structure for table `sweepstakes`
--

CREATE TABLE `sweepstakes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `program_id` bigint(20) NOT NULL,
  `win_once` tinyint(1) NOT NULL DEFAULT '0',
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `start_ticket_no` bigint(20) NOT NULL,
  `ticket_prefix` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '1',
  `is_extend` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `number_of_winners` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sweepstakes`
--

INSERT INTO `sweepstakes` (`id`, `name`, `slug`, `program_id`, `win_once`, `start_date`, `end_date`, `start_ticket_no`, `ticket_prefix`, `status`, `is_extend`, `created_at`, `updated_at`, `number_of_winners`) VALUES
(7, 'GemZone', 'test-sweepstake', 0, 1, '2020-02-17 12:13:16', '2020-02-20 12:13:16', 200, 'GZ', 1, 1, '2020-05-06 06:50:20', '2020-07-21 10:28:44', 3),
(8, 'test sweepstake', 'SWP1vDVFJOymFz', 0, 1, '2020-02-27 15:08:44', '2020-02-28 15:08:44', 200, 'TS', 1, 0, '2020-07-21 11:44:39', '2020-07-21 11:44:39', 3);

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

--
-- Table structure for table `tickets`
--

CREATE TABLE `tickets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sweepstake_id` bigint(20) NOT NULL,
  `customer_id` int(11) NOT NULL,
  `ticket_number` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` tinyint(4) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tickets`
--

INSERT INTO `tickets` (`id`, `sweepstake_id`, `customer_id`, `ticket_number`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '364', 1, '2020-04-12 21:37:07', '2020-07-21 11:51:21'),
(2, 1, 2, '51', 1, '2020-04-12 22:31:39', '2020-07-21 11:51:23'),
(3, 1, 3, '375', 2, '2020-04-12 22:31:44', '2020-07-21 11:51:25'),
(4, 1, 4, '944', 2, '2020-04-12 22:31:50', '2020-07-21 11:51:27'),
(5, 8, 2, 'TS896', 1, '2020-07-21 14:12:21', '2020-07-21 14:12:21');

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

--
-- Table structure for table `winners`
--

CREATE TABLE `winners` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sweepstake_id` bigint(20) NOT NULL,
  `sweepstake_prize_id` bigint(20) NOT NULL,
  `draw_date` datetime NOT NULL,
  `status` tinyint(4) DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `ticket_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `winners`
--

INSERT INTO `winners` (`id`, `sweepstake_id`, `sweepstake_prize_id`, `draw_date`, `status`, `created_at`, `updated_at`, `ticket_number`) VALUES
(7, 0, 0, '2020-04-23 16:26:04', NULL, '2020-04-23 16:26:04', '2020-07-21 10:29:16', 'GZ51'),
(8, 0, 0, '2020-04-23 16:28:57', NULL, '2020-04-23 16:28:57', '2020-07-21 10:29:23', 'GZ52'),
(9, 0, 0, '2020-04-23 16:32:57', NULL, '2020-04-23 16:32:57', '2020-07-21 10:29:32', 'GZ54');

--
-- Indexes for table `logs`
--
ALTER TABLE `logs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `prize`
--
ALTER TABLE `prize`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `rand_gen`
--
ALTER TABLE `rand_gen`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sweepstakes`
--
ALTER TABLE `sweepstakes`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tickets`
--
ALTER TABLE `tickets`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `winners`
--
ALTER TABLE `winners`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for table `logs`
--
ALTER TABLE `logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `prize`
--
ALTER TABLE `prize`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `rand_gen`
--
ALTER TABLE `rand_gen`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `sweepstakes`
--
ALTER TABLE `sweepstakes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `tickets`
--
ALTER TABLE `tickets`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `winners`
--
ALTER TABLE `winners`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
