CREATE TABLE `uploads` (
  `id` int(11) NOT NULL,
  `file_original_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `file_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `file_size` int(11) DEFAULT NULL,
  `extension` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(15) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `uploads`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `uploads`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;


-- Category Translation
CREATE TABLE `category_translations` (
`id` bigint(20) NOT NULL,
`category_id` bigint(20) NOT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `category_translations`
    ADD PRIMARY KEY (`id`);

ALTER TABLE `category_translations`
    MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Sub Category Translation
CREATE TABLE `sub_category_translations` (
  `id` bigint(20) NOT NULL,
  `sub_category_id` bigint(20) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `sub_category_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `sub_category_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Sub SubCategory Translation
CREATE TABLE `sub_sub_category_translations` (
    `id` bigint(20) NOT NULL,
    `sub_sub_category_id` bigint(20) NOT NULL,
    `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
    `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `sub_sub_category_translations`
    ADD PRIMARY KEY (`id`);

ALTER TABLE `sub_sub_category_translations`
    MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Brand Translation
CREATE TABLE `brand_translations` (
  `id` bigint(20) NOT NULL,
  `brand_id` bigint(20) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `brand_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `brand_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Product Translation
CREATE TABLE `product_translations` (
  `id` bigint(20) NOT NULL,
  `product_id` bigint(20) NOT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
  `unit` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `description` longtext COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `product_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `product_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Attributes Translation
CREATE TABLE `attribute_translations` (
  `id` bigint(20) NOT NULL,
  `attribute_id` bigint(20) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `attribute_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `attribute_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Customer Package Translation
CREATE TABLE `customer_package_translations` (
  `id` bigint(20) NOT NULL,
  `customer_package_id` bigint(20) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `customer_package_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `customer_package_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Flash Deal Translation
CREATE TABLE `flash_deal_translations` (
  `id` bigint(20) NOT NULL,
  `flash_deal_id` bigint(20) NOT NULL,
  `title` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `flash_deal_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `flash_deal_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- pick-up Point Translation
CREATE TABLE `pickup_point_translations` (
  `id` bigint(20) NOT NULL,
  `pickup_point_id` bigint(20) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `address` text COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `pickup_point_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `pickup_point_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Role Translation
CREATE TABLE `role_translations` (
  `id` bigint(20) NOT NULL,
  `role_id` bigint(20) NOT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `role_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `role_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

-- Page Translation
CREATE TABLE `page_translations` (
  `id` bigint(20) NOT NULL,
  `page_id` bigint(20) NOT NULL,
  `title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `content` text COLLATE utf8_unicode_ci DEFAULT NULL,
  `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `page_translations`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `page_translations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


-- Customer Product Translation
CREATE TABLE `customer_product_translations` (
    `id` bigint(20) NOT NULL,
    `customer_product_id` bigint(20) NOT NULL,
    `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
    `unit` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
    `description` longtext COLLATE utf8_unicode_ci DEFAULT NULL,
    `lang` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `customer_product_translations`
    ADD PRIMARY KEY (`id`);

ALTER TABLE `customer_product_translations`
    MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;


ALTER TABLE `pages` ADD `type` VARCHAR(50) NOT NULL AFTER `id`;

INSERT INTO `pages` (`type`, `title`, `slug`, `content`, `meta_title`, `meta_description`, `keywords`, `meta_image`, `created_at`, `updated_at`) VALUES
('home_page', 'Home Page', 'home', NULL, NULL, NULL, NULL, NULL, '2020-11-04 10:13:20', '2020-11-04 10:13:20'),
('seller_policy_page', 'Seller Policy Pages', 'sellerpolicy', NULL, NULL, NULL, NULL, NULL, '2020-11-04 10:14:41', '2020-11-04 12:19:30'),
('return_policy_page', 'Return Policy Page', 'returnpolicy', NULL, NULL, NULL, NULL, NULL, '2020-11-04 10:14:41', '2020-11-04 10:14:41'),
('support_policy_page', 'Support Policy Page', 'supportpolicy', NULL, NULL, NULL, NULL, NULL, '2020-11-04 10:14:59', '2020-11-04 10:14:59'),
('terms_conditions_page', 'Term Conditions Page', 'terms', NULL, NULL, NULL, NULL, NULL, '2020-11-04 10:15:29', '2020-11-04 10:15:29'),
('privacy_policy_page', 'Privacy Policy Page', 'privacypolicy', NULL, NULL, NULL, NULL, NULL, '2020-11-04 10:15:55', '2020-11-04 10:15:55');


INSERT INTO `business_settings` (`type`, `value`, `created_at`, `updated_at`) VALUES

    ('header_logo', NULL, current_timestamp(), current_timestamp()),

    ('show_language_switcher', 'on', current_timestamp(), current_timestamp()),

    ('show_currency_switcher', 'on', current_timestamp(), current_timestamp()),

    ('header_stikcy', 'on', current_timestamp(), current_timestamp()),

    ('footer_logo', NULL, current_timestamp(), current_timestamp()),

    ('about_us_description', NULL, current_timestamp(), current_timestamp()),

    ('contact_address', NULL, current_timestamp(), current_timestamp()),

    ('contact_phone', NULL, current_timestamp(), current_timestamp()),

    ('contact_email', NULL, current_timestamp(), current_timestamp()),

    ('widget_one_labels', NULL, current_timestamp(), current_timestamp()),

    ('widget_one_links', NULL, current_timestamp(), current_timestamp()),

    ('widget_one', NULL, current_timestamp(), current_timestamp()),

    ('frontend_copyright_text', NULL, current_timestamp(), current_timestamp()),

    ('show_social_links', NULL, current_timestamp(), current_timestamp()),

    ('facebook_link', NULL, current_timestamp(), current_timestamp()),

    ('twitter_link', NULL, current_timestamp(), current_timestamp()),

    ('instagram_link', NULL, current_timestamp(), current_timestamp()),

    ('youtube_link', NULL, current_timestamp(), current_timestamp()),

    ('linkedin_link', NULL, current_timestamp(), current_timestamp()),

    ('payment_method_images', NULL, current_timestamp(), current_timestamp()),

    ('home_slider_images', '[]', current_timestamp(), current_timestamp()),

    ('home_slider_links', '[]', current_timestamp(), current_timestamp()),

    ('home_banner1_images', '[]', current_timestamp(), current_timestamp()),

    ('home_banner1_links', '[]', current_timestamp(), current_timestamp()),

    ('home_banner2_images', '[]', current_timestamp(), current_timestamp()),

    ('home_banner2_links', '[]', current_timestamp(), current_timestamp()),

    ('home_categories', '[]', current_timestamp(), current_timestamp()),

    ('top10_categories', '[]', current_timestamp(), current_timestamp()),

    ('top10_brands', '[]', current_timestamp(), current_timestamp()),

    ('website_name', NULL, current_timestamp(), current_timestamp()),

    ('site_motto', NULL, current_timestamp(), current_timestamp()),

    ('site_icon', NULL, current_timestamp(), current_timestamp()),

    ('base_color', '#e62e04', current_timestamp(), current_timestamp()),

    ('base_hov_color', '#e62e04', current_timestamp(), current_timestamp()),

    ('meta_title', NULL, current_timestamp(), current_timestamp()),

    ('meta_description', NULL, current_timestamp(), current_timestamp()),

    ('meta_keywords', NULL, current_timestamp(), current_timestamp()),

    ('meta_image', NULL, current_timestamp(), current_timestamp()),

    ('site_name', NULL, current_timestamp(), current_timestamp()),

    ('system_logo_white', NULL, current_timestamp(), current_timestamp()),

    ('system_logo_black', NULL, current_timestamp(), current_timestamp()),

    ('timezone', NULL, current_timestamp(), current_timestamp()),

    ('admin_login_background', NULL, current_timestamp(), current_timestamp());


    CREATE TABLE `translations` (
      `id` int(11) NOT NULL,
      `lang` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
      `lang_key` text COLLATE utf8_unicode_ci,
      `lang_value` text COLLATE utf8_unicode_ci,
      `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;






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

    --
    -- AUTO_INCREMENT for dumped tables
    --

    --
    -- AUTO_INCREMENT for table `translations`
    --
    ALTER TABLE `translations`
      MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;


    ALTER TABLE `wallets` CHANGE `payment_method` `payment_method` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;

    UPDATE `business_settings` SET `value` = '3.6' WHERE `business_settings`.`type` = 'current_version';

COMMIT;
