ALTER TABLE `product_options` ADD `option_id` INT NULL DEFAULT NULL AFTER `shop_id`, ADD `product_id` INT NULL DEFAULT NULL AFTER `option_id`;
ALTER TABLE `product_galleries` ADD `product_option_id` INT UNSIGNED NULL DEFAULT NULL AFTER `product_id`;

CREATE TABLE `options` (
  `id` int(10) UNSIGNED NOT NULL,
  `shop_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `title` varchar(150) CHARACTER SET utf8 DEFAULT NULL,
  `description` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
  `state` int(11) NOT NULL DEFAULT '1',
  `is_deleted` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) DEFAULT NULL,
  `updated_by` int(11) DEFAULT NULL,
  `deleted_by` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE `options` ADD PRIMARY KEY (`id`);
ALTER TABLE `options` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;COMMIT;


CREATE TABLE `option_groups` (
  `id` int(11) NOT NULL,
  `shop_id` int(11) NOT NULL,
  `title` varchar(150) CHARACTER SET utf8 DEFAULT NULL,
  `description` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
  `state` int(11) NOT NULL DEFAULT '1',
  `is_deleted` int(11) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `updated_by` int(11) DEFAULT NULL,
  `deleted_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

ALTER TABLE `option_groups` ADD PRIMARY KEY (`id`);
ALTER TABLE `option_groups` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;COMMIT;


CREATE TABLE `price_options` (
  `id` int(10) UNSIGNED NOT NULL,
  `shop_id` int(11) NOT NULL,
  `product_option_id` int(10) UNSIGNED NOT NULL,
  `unique_id` varchar(50) CHARACTER SET utf8 NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE `price_options` ADD PRIMARY KEY (`id`);
ALTER TABLE `price_options` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;COMMIT;

CREATE TABLE `product_prices` (
  `id` int(11) NOT NULL,
  `shop_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `price_option_unique_id` varchar(50) CHARACTER SET utf8 NOT NULL,
  `price` decimal(18,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE `product_prices` ADD PRIMARY KEY (`id`);
ALTER TABLE `product_prices` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;COMMIT;
ALTER TABLE `product_prices` ADD UNIQUE `product_id_unique_id` (`product_id`, `price_option_unique_id`);



ALTER TABLE `product_options` ADD images VARCHAR(500) NULL AFTER `property`;

ALTER TABLE `purchase_transaction_details` ADD `property` TEXT DEFAULT NULL AFTER `purchase_transaction_id`;
