USE makhzon;

ALTER TABLE `t_category` DROP FOREIGN KEY `fk_t_category_t_category_1`;
ALTER TABLE `t_category_statistics` DROP FOREIGN KEY `fk_t_category_statistics_t_category_1`;
ALTER TABLE `t_comment` DROP FOREIGN KEY `fk_t_comment_t_topic_1`;
ALTER TABLE `t_comment` DROP FOREIGN KEY `fk_t_comment_t_user_1`;
ALTER TABLE `t_comment_statistics` DROP FOREIGN KEY `t_comment_statistics_ibfk_1`;
ALTER TABLE `t_notification_summary` DROP FOREIGN KEY `t_notification_summary_ibfk_1`;
ALTER TABLE `t_resource_relation` DROP FOREIGN KEY `aaaa`;
ALTER TABLE `t_spam_relation` DROP FOREIGN KEY `fk_t_spam_relation_t_user_1`;
ALTER TABLE `t_tag_relation` DROP FOREIGN KEY `fk_t_tag_relation_t_tag_1`;
ALTER TABLE `t_tag_statistics` DROP FOREIGN KEY `fk_v_tag_statistics_t_tag_1`;
ALTER TABLE `t_product` DROP FOREIGN KEY `fk_t_topic_t_user_1`;
ALTER TABLE `t_product` DROP FOREIGN KEY `t_topic_ibfk_1`;
ALTER TABLE `t_product_statistics` DROP FOREIGN KEY `fk_t_topic_statistics_t_topic_1`;
ALTER TABLE `t_user` DROP FOREIGN KEY `fk_t_user_t_user_role_1`;
ALTER TABLE `t_user_device` DROP FOREIGN KEY `fk_t_user_device_t_user_1`;
ALTER TABLE `t_user_forget_password` DROP FOREIGN KEY `fk_t_user_forgot_password_t_user_1`;
ALTER TABLE `t_user_provider` DROP FOREIGN KEY `fk_t_user_provider_t_user_1`;
ALTER TABLE `t_user_social_relation` DROP FOREIGN KEY `fk_t_user_social_relation_t_user_1`;
ALTER TABLE `t_user_statistics` DROP FOREIGN KEY `fk_t_user_statistics_t_user_1`;
ALTER TABLE `t_user_verification` DROP FOREIGN KEY `fk_t_user_verification_t_user_1`;
ALTER TABLE `t_user_verification_log` DROP FOREIGN KEY `t_user_verification_log_ibfk_1`;
ALTER TABLE `t_province` DROP FOREIGN KEY `fk_t_province_t_country_1`;
ALTER TABLE `t_city` DROP FOREIGN KEY `fk_t_city_t_province_1`;
ALTER TABLE `t_country` DROP FOREIGN KEY `fk_t_country_t_continent_1`;
ALTER TABLE `t_address` DROP FOREIGN KEY `fk_t_address_t_user_1`;
ALTER TABLE `t_product_supplier` DROP FOREIGN KEY `fk_t_topic_supplier_t_topic_1`;
ALTER TABLE `t_order_details` DROP FOREIGN KEY `fk_t_order_details_t_order_1`;
ALTER TABLE `t_order` DROP FOREIGN KEY `fk_t_order_t_coupon_1`;
ALTER TABLE `t_product_resource` DROP FOREIGN KEY `fk_t_product_resource_t_topic_1`;
ALTER TABLE `t_order_details` DROP FOREIGN KEY `fk_t_order_sell_details_t_product_1`;
ALTER TABLE `t_order` DROP FOREIGN KEY `fk_t_order_sell_t_user_1`;
ALTER TABLE `t_product_warehouse` DROP FOREIGN KEY `fk_t_product_warehouse_t_product_1`;
ALTER TABLE `t_product_warehouse` DROP FOREIGN KEY `fk_t_product_warehouse_t_warehouse_1`;
ALTER TABLE `t_product_supplier` DROP FOREIGN KEY `fk_t_product_supplier_t_user_1`;
ALTER TABLE `t_address` DROP FOREIGN KEY `fk_t_address_t_country_1`;
ALTER TABLE `t_address` DROP FOREIGN KEY `fk_t_address_t_province_1`;
ALTER TABLE `t_address` DROP FOREIGN KEY `fk_t_address_t_city_1`;
ALTER TABLE `t_category_tax` DROP FOREIGN KEY `fk_t_product_tax_t_tax_1`;
ALTER TABLE `t_product_unit` DROP FOREIGN KEY `fk_t_product_unit_t_product_1`;
ALTER TABLE `t_product_unit` DROP FOREIGN KEY `fk_t_product_unit_t_unit_1`;
ALTER TABLE `t_category_tax` DROP FOREIGN KEY `fk_t_category_tax_t_category_1`;
ALTER TABLE `t_product` DROP FOREIGN KEY `fk_t_product_t_brand_1`;
ALTER TABLE `t_notification_users` DROP FOREIGN KEY `fk_t_notification_users_t_notification_1`;
ALTER TABLE `t_notification_users` DROP FOREIGN KEY `fk_t_notification_users_t_user_1`;
ALTER TABLE `t_notification` DROP FOREIGN KEY `fk_t_notification_t_notification_template_1`;
ALTER TABLE `t_notification` DROP FOREIGN KEY `fk_t_notification_t_user_2`;

DROP INDEX `fk_i_continent_id` ON `t_country`;

DROP TABLE `lib_logg`;
DROP TABLE `sequence_data`;
DROP TABLE `t_ban_rule`;
DROP TABLE `t_category`;
DROP TABLE `t_category_statistics`;
DROP TABLE `t_comment`;
DROP TABLE `t_comment_statistics`;
DROP TABLE `t_content_version`;
DROP TABLE `t_log_request`;
DROP TABLE `t_log_table`;
DROP TABLE `t_notification_summary`;
DROP TABLE `t_notification_template`;
DROP TABLE `t_resource`;
DROP TABLE `t_resource_relation`;
DROP TABLE `t_resource_temp`;
DROP TABLE `t_spam_relation`;
DROP TABLE `t_tag`;
DROP TABLE `t_tag_relation`;
DROP TABLE `t_tag_statistics`;
DROP TABLE `t_product`;
DROP TABLE `t_product_statistics`;
DROP TABLE `t_user`;
DROP TABLE `t_user_device`;
DROP TABLE `t_user_forget_password`;
DROP TABLE `t_user_provider`;
DROP TABLE `t_user_role`;
DROP TABLE `t_user_social_relation`;
DROP TABLE `t_user_statistics`;
DROP TABLE `t_user_verification`;
DROP TABLE `t_user_verification_log`;
DROP TABLE `t_city`;
DROP TABLE `t_continent`;
DROP TABLE `t_country`;
DROP TABLE `t_province`;
DROP TABLE `t_brand`;
DROP TABLE `t_tax`;
DROP TABLE `t_currency`;
DROP TABLE `t_contact_us`;
DROP TABLE `t_address`;
DROP TABLE `t_product_supplier`;
DROP TABLE `t_coupon`;
DROP TABLE `t_order_details`;
DROP TABLE `t_order`;
DROP TABLE `t_product_resource`;
DROP TABLE `t_unit`;
DROP TABLE `t_warehouse`;
DROP TABLE `t_product_warehouse`;
DROP TABLE `t_settings`;
DROP TABLE `t_category_tax`;
DROP TABLE `t_product_unit`;
DROP TABLE `t_delivery_fee`;
DROP TABLE `t_notification`;
DROP TABLE `t_notification_users`;

CREATE TABLE `lib_logg` (
`whn` datetime NOT NULL,
`thread` int(10) UNSIGNED NOT NULL,
`level` enum('info','warn','error') NOT NULL DEFAULT 'info',
`str` text NOT NULL
)
ENGINE = MyISAM
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `sequence_data` (
`sequence_name` varchar(100) NOT NULL,
`sequence_increment` int(11) UNSIGNED NOT NULL DEFAULT 1,
`sequence_min_value` int(11) UNSIGNED NOT NULL DEFAULT 1,
`sequence_max_value` bigint(20) UNSIGNED NOT NULL DEFAULT 18446744073709551615,
`sequence_cur_value` bigint(20) UNSIGNED NULL DEFAULT 1,
`sequence_cycle` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`sequence_name`)
)
ENGINE = MyISAM
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_ban_rule` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`i_type` int(11) NOT NULL DEFAULT 0,
`s_value` varchar(128) NOT NULL,
`i_user_id` int(11) NULL DEFAULT NULL,
`dt_expiration_date` datetime NULL DEFAULT NULL,
`dt_created_date` datetime NOT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = MyISAM
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_category` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_parent_id` int(11) NULL DEFAULT NULL,
`s_path` varchar(255) NULL DEFAULT NULL,
`s_name_ar` varchar(255) NULL DEFAULT NULL,
`s_name_en` varchar(255) NULL DEFAULT NULL,
`s_icon` varchar(1024) NULL DEFAULT NULL,
`i_sort` int(11) NULL DEFAULT 0,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_category_statistics` (
`fk_i_category_id` int(11) NOT NULL,
`i_products_count` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`fk_i_category_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_comment` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_topic_id` int(11) NOT NULL,
`fk_i_user_id` int(11) NOT NULL,
`s_details` varchar(2048) NOT NULL,
`s_options` text NULL,
`b_spam` int(1) NOT NULL DEFAULT 0,
`i_version` int(11) NOT NULL DEFAULT 1,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_comment_statistics` (
`fk_i_comment_id` int(11) NOT NULL,
`i_views_count` int(11) NOT NULL DEFAULT 0,
`i_spams_count` int(11) NOT NULL DEFAULT 0,
`i_favorites_count` int(11) NOT NULL DEFAULT 0,
`i_followers_count` int(11) NOT NULL DEFAULT 0,
`i_likes_count` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`fk_i_comment_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_content_version` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_table_name` varchar(128) NOT NULL,
`fk_i_ref_id` int(11) NOT NULL,
`s_object` json NOT NULL,
`i_version` int(11) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Compact
;
CREATE TABLE `t_log_request` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`s_request_id` varchar(128) NULL DEFAULT NULL,
`s_request_url` varchar(256) NULL DEFAULT NULL,
`s_request_method` varchar(32) NULL DEFAULT NULL,
`s_request_headers` longtext NULL,
`s_request_params` longtext NULL,
`i_response_status_code` int(11) NULL DEFAULT NULL,
`s_response_headers` longtext NULL,
`s_response_body` longtext NULL,
`s_ip_address` varchar(128) NOT NULL,
`dt_created_date` datetime NOT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = MyISAM
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_log_table` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`s_request_id` varchar(128) NULL DEFAULT NULL,
`s_request_url` varchar(256) NULL DEFAULT NULL,
`s_request_method` varchar(32) NULL DEFAULT NULL,
`s_request_headers` longtext NULL,
`s_request_params` longtext NULL,
`s_table_name` varchar(128) NULL DEFAULT NULL,
`s_sql_operation` varchar(32) NULL DEFAULT NULL,
`s_fields_changed` longtext NULL,
`s_fields_before` longtext NULL,
`s_fields_after` longtext NULL,
`s_ip_address` varchar(128) NOT NULL,
`dt_created_date` datetime NOT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = MyISAM
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_notification_summary` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_title` varchar(8192) NULL DEFAULT NULL,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`fk_i_actor_user_id` int(11) NOT NULL,
`i_actor_users_count` int(11) NULL DEFAULT 0,
`s_actor_user_ids` varchar(1024) NULL DEFAULT NULL,
`i_target_users_type` int(11) NOT NULL DEFAULT 2,
`i_activity_verb` int(11) NULL DEFAULT NULL,
`i_object_type` int(11) NULL DEFAULT NULL,
`i_object_id` int(11) NULL DEFAULT NULL,
`s_object_ids` varchar(1024) NULL DEFAULT NULL,
`i_target_type` int(11) NULL DEFAULT NULL,
`i_target_id` int(11) NULL DEFAULT NULL,
`i_template_id` int(11) NOT NULL DEFAULT 0,
`i_action_type` int(11) NULL DEFAULT NULL,
`i_action_subtype` int(11) NULL DEFAULT NULL,
`s_extra_1` varchar(255) NULL DEFAULT NULL,
`s_extra_2` varchar(255) NULL DEFAULT NULL,
`b_pushed` int(1) NOT NULL DEFAULT 0,
`dt_seen_date` datetime NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Compact
;
CREATE TABLE `t_notification_template` (
`pk_i_id` int(11) NOT NULL,
`s_template` varchar(1024) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_resource` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_directory` varchar(255) NULL DEFAULT NULL,
`s_name` varchar(255) NOT NULL,
`s_title` varchar(255) NULL DEFAULT NULL,
`i_type` int(11) NOT NULL DEFAULT 0,
`i_file_size` int(11) NULL DEFAULT NULL,
`d_width` double NULL DEFAULT NULL,
`d_height` double NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_resource_relation` (
`fk_i_resource_id` int(11) NOT NULL,
`fk_i_ref_id` int(11) NOT NULL,
`i_type` int(11) NOT NULL,
`dt_created_date` datetime NOT NULL,
PRIMARY KEY (`fk_i_resource_id`, `fk_i_ref_id`, `i_type`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_resource_temp` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_request_id` varchar(128) NULL DEFAULT NULL,
`s_name` varchar(255) NOT NULL,
`s_title` varchar(255) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_spam_relation` (
`fk_i_user_id` int(11) NOT NULL,
`fk_i_ref_id` int(11) NOT NULL,
`i_type` int(11) NOT NULL,
`i_spam_type` int(11) NOT NULL DEFAULT 0,
`s_other` varchar(1024) NULL DEFAULT NULL,
`dt_created_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`fk_i_user_id`, `fk_i_ref_id`, `i_type`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_tag` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_tag_relation` (
`fk_i_tag_id` int(11) NOT NULL,
`fk_i_ref_id` int(11) NOT NULL,
`i_type` int(11) NOT NULL,
`dt_created_date` datetime NOT NULL,
PRIMARY KEY (`fk_i_tag_id`, `fk_i_ref_id`, `i_type`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_tag_statistics` (
`fk_i_tag_id` int(11) NOT NULL,
`i_categories_count` int(11) NOT NULL DEFAULT 0,
`i_topics_count` int(11) NOT NULL DEFAULT 0,
`i_comments_count` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`fk_i_tag_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_product` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`fk_i_category_id` int(11) NULL DEFAULT NULL,
`fk_i_brand_id` int(11) NULL DEFAULT NULL,
`s_slug` varchar(255) NULL DEFAULT NULL,
`s_name_ar` varchar(255) NOT NULL,
`s_name_en` varchar(255) NULL DEFAULT NULL,
`s_description_ar` text NOT NULL,
`s_description_en` text NULL,
`s_barcode` varchar(255) NOT NULL,
`d_price_old` double(11,2) NULL DEFAULT NULL,
`d_price` double(11,2) NULL,
`s_currency_code` varchar(3) NOT NULL,
`d_quantity` double(10,2) NULL DEFAULT 0,
`d_length` double(10,2) NULL DEFAULT NULL,
`d_width` double(10,2) NULL DEFAULT NULL,
`d_height` double(10,2) NULL DEFAULT NULL,
`d_weight` double(10,2) NULL,
`s_options` text NULL,
`i_status` int(11) NULL DEFAULT 1,
`dt_status_date` datetime NULL DEFAULT NULL,
`i_order` int(11) NOT NULL DEFAULT 0,
`b_spam` int(1) NOT NULL DEFAULT 0,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_product_statistics` (
`fk_i_product_id` int(11) NOT NULL,
`i_views_count` int(11) NOT NULL DEFAULT 0,
`i_comments_count` int(11) NOT NULL DEFAULT 0,
`i_favorites_count` int(11) NOT NULL DEFAULT 0,
`i_followers_count` int(11) NOT NULL DEFAULT 0,
`i_likes_count` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`fk_i_product_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_role_id` int(11) NOT NULL,
`s_name_ar` varchar(255) NULL DEFAULT NULL,
`s_name_en` varchar(255) NULL DEFAULT NULL,
`s_email` varchar(255) NULL DEFAULT NULL,
`s_password` varchar(255) NULL DEFAULT NULL,
`i_gender` int(11) NULL DEFAULT NULL,
`s_mobile_number` varchar(32) NULL DEFAULT NULL,
`s_avatar` varchar(255) NULL DEFAULT NULL,
`s_cover_photo` varchar(255) NULL DEFAULT NULL,
`d_location_latitude` double(11,8) NULL DEFAULT NULL,
`d_location_longitude` double(11,8) NULL DEFAULT NULL,
`s_address` varchar(255) NULL DEFAULT NULL,
`s_vat_number` varchar(32) NULL DEFAULT NULL,
`d_credit` double(10,2) NULL DEFAULT 0,
`dt_notification_seen_date` datetime NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_device` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`s_udid` varchar(128) NOT NULL,
`s_access_token` varchar(255) NULL DEFAULT NULL,
`s_aps_token` varchar(512) NULL DEFAULT NULL,
`s_fcm_token` varchar(512) NULL DEFAULT NULL,
`s_client_user_agent` varchar(255) NULL DEFAULT NULL,
`s_client_version_name` varchar(32) NULL DEFAULT NULL,
`s_client_version_code` varchar(32) NULL DEFAULT NULL,
`s_client_platform_name` varchar(32) NULL DEFAULT NULL,
`s_client_platform_version` varchar(32) NULL DEFAULT NULL,
`s_client_device_type` varchar(32) NULL DEFAULT NULL,
`s_client_device_name` varchar(32) NULL DEFAULT NULL,
`s_client_timezone_name` varchar(128) NULL DEFAULT NULL,
`s_client_language` varchar(32) NULL DEFAULT NULL,
`s_ip_address` varchar(40) NULL DEFAULT NULL,
`dt_verified_date` datetime NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_forget_password` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NOT NULL,
`s_token` varchar(512) NOT NULL,
`dt_expired_date` datetime NULL DEFAULT NULL,
`dt_confirmed_date` datetime NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_provider` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`s_type` varchar(128) NOT NULL,
`s_provider_user_id` varchar(128) NOT NULL,
`s_provider_login_key` varchar(128) NULL DEFAULT NULL,
`s_provider_name` varchar(128) NULL DEFAULT NULL,
`s_provider_picture` text NULL,
`s_provider_token` text NOT NULL,
`s_provider_token_json` json NULL DEFAULT NULL,
`dt_issue_date` datetime NULL DEFAULT NULL,
`dt_expired_date` datetime NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_role` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_social_relation` (
`fk_i_user_id` int(11) NOT NULL,
`fk_i_ref_id` int(11) NOT NULL,
`i_type` int(11) NOT NULL,
`dt_created_date` datetime NOT NULL,
PRIMARY KEY (`fk_i_user_id`, `fk_i_ref_id`, `i_type`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_statistics` (
`fk_i_user_id` int(11) NOT NULL,
`i_topics_count` int(11) NOT NULL DEFAULT 0,
`i_comments_count` int(11) NOT NULL DEFAULT 0,
`i_favorites_topics_count` int(11) NOT NULL DEFAULT 0,
`i_followings_topics_count` int(11) NOT NULL DEFAULT 0,
`i_followers_users_count` int(11) NOT NULL DEFAULT 0,
`i_followings_users_count` int(11) NOT NULL DEFAULT 0,
`i_notifications_count` int(11) NOT NULL DEFAULT 0,
`i_topics_likes_count` int(11) NOT NULL DEFAULT 0,
`i_comments_likes_count` int(11) NOT NULL DEFAULT 0,
`i_likes_count` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`fk_i_user_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_verification` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(10) NULL DEFAULT NULL,
`s_udid` varchar(255) NOT NULL,
`i_method` int(11) NOT NULL DEFAULT 0,
`s_verification_user_id` varchar(255) NULL DEFAULT NULL,
`s_verification_request_id` varchar(255) NULL DEFAULT NULL,
`s_passcode` varchar(255) NULL DEFAULT NULL,
`s_ip_address` varchar(255) NULL DEFAULT NULL,
`dt_expiration_date` datetime NULL DEFAULT NULL,
`dt_confirmation_date` datetime NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_user_verification_log` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`s_udid` varchar(255) NOT NULL,
`s_passcode` varchar(255) NOT NULL,
`s_ip_address` varchar(255) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_city` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_province_id` int(11) NOT NULL,
`s_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_code` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_flag` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`b_capital` int(1) NULL DEFAULT NULL,
`d_area_km` double(8,2) NULL DEFAULT NULL COMMENT 'Area in Kilometer Square',
`i_population` int(11) NULL DEFAULT NULL,
`d_location_longitude` double(11,8) NULL DEFAULT NULL,
`d_location_latitude` double(11,8) NULL DEFAULT NULL,
`s_timezone` varchar(128) NULL DEFAULT NULL,
`i_phone_prefix` int(11) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_continent` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_code` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`d_area_km` double(8,2) NULL DEFAULT NULL COMMENT 'Area in Kilometer Square',
`i_population` int(11) NULL DEFAULT NULL,
`d_location_longitude` double(11,8) NULL DEFAULT NULL,
`d_location_latitude` double(11,8) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_country` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_continent_id` int(11) NOT NULL,
`s_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_code` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_flag` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`s_nationality_name` varchar(255) NULL DEFAULT NULL,
`d_area_km` double(8,2) NULL DEFAULT NULL COMMENT 'Area in Kilometer Square',
`i_population` int(11) NULL DEFAULT NULL,
`d_location_longitude` double(11,8) NULL DEFAULT NULL,
`d_location_latitude` double(11,8) NULL DEFAULT NULL,
`s_timezone` varchar(128) NULL DEFAULT NULL,
`i_phone_prefix` int(11) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`) ,
INDEX `fk_i_continent_id` (`fk_i_continent_id` ASC) USING BTREE
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_province` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_country_id` int(11) NOT NULL,
`s_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_code` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_flag` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`b_capital` int(1) NULL DEFAULT NULL,
`d_area_km` double(8,2) NULL DEFAULT NULL COMMENT 'Area in Kilometer Square',
`i_population` int(11) NULL DEFAULT NULL,
`d_location_longitude` double(11,8) NULL DEFAULT NULL,
`d_location_latitude` double(11,8) NULL DEFAULT NULL,
`s_timezone` varchar(128) NULL DEFAULT NULL,
`i_phone_prefix` int(11) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_brand` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`s_slug` varchar(255) NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_tax` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`d_percentage` float(10,2) NOT NULL,
`b_default` int(1) NULL DEFAULT 0,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_currency` (
`pk_i_id` int(10) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`s_code` varchar(255) NOT NULL,
`s_symbol` varchar(255) NOT NULL,
`d_exchange_rate` double(10,4) NOT NULL DEFAULT 1,
`s_decimal_point` varchar(1) NULL DEFAULT NULL,
`s_thousand_point` varchar(1) NULL DEFAULT NULL,
`b_default` int(1) NULL DEFAULT 0,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_unicode_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_contact_us` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NULL DEFAULT NULL,
`i_type` int(11) NOT NULL DEFAULT 0,
`s_title` varchar(1024) NOT NULL,
`s_details` varchar(2048) NOT NULL,
`s_mobile_number` varchar(32) NULL DEFAULT NULL,
`s_email` varchar(255) NULL DEFAULT NULL,
`s_udid` varchar(255) NULL DEFAULT NULL,
`s_fcm_token` varchar(512) NULL DEFAULT NULL,
`s_client_user_agent` varchar(255) NULL DEFAULT NULL,
`s_client_version_name` varchar(32) NULL DEFAULT NULL,
`s_client_version_code` varchar(32) NULL DEFAULT NULL,
`s_client_platform_name` varchar(32) NULL DEFAULT NULL,
`s_client_platform_version` varchar(32) NULL DEFAULT NULL,
`s_client_device_type` varchar(32) NULL DEFAULT NULL,
`s_client_device_name` varchar(32) NULL DEFAULT NULL,
`s_client_timezone_name` varchar(128) NULL DEFAULT NULL,
`s_client_language` varchar(32) NULL DEFAULT NULL,
`s_ip_address` varchar(40) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_address` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NULL,
`fk_i_user_id` int(11) NOT NULL,
`fk_i_country_id` int(11) NULL DEFAULT NULL,
`fk_i_province_id` int(11) NULL DEFAULT NULL,
`fk_i_city_id` int(11) NULL DEFAULT NULL,
`s_address` varchar(255) NULL DEFAULT NULL,
`s_address_two` varchar(255) NULL DEFAULT NULL,
`s_address_three` varchar(255) NULL DEFAULT NULL,
`s_zip` varchar(255) NULL DEFAULT NULL,
`d_location_latitude` double(11,8) NULL DEFAULT NULL,
`d_location_longitude` double(11,8) NULL DEFAULT NULL,
`b_shipping` int(1) NOT NULL DEFAULT 0,
`b_billing` int(1) NOT NULL DEFAULT 0,
`b_default` int(1) NOT NULL DEFAULT 0,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_product_supplier` (
`fk_i_product_id` int(11) NOT NULL,
`fk_i_user_supplier_id` int(11) NOT NULL,
`s_barcode` varchar(255) NULL DEFAULT NULL COMMENT 'used if there is a special code assigned by supplier',
`d_quantity` double(10,2) NOT NULL DEFAULT 0,
`d_price` double(11,2) NULL DEFAULT NULL COMMENT 'last buy price',
`s_currency_code` varchar(3) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`fk_i_product_id`, `fk_i_user_supplier_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_coupon` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name_ar` varchar(255) NOT NULL,
`s_name_en` varchar(255) NOT NULL,
`s_code` varchar(255) NOT NULL,
`d_discount_percentage` double(10,2) NOT NULL DEFAULT 0,
`d_discount_value` double(10,2) NOT NULL DEFAULT 0,
`dt_start_date` datetime NULL DEFAULT NULL,
`dt_finish_date` datetime NULL DEFAULT NULL,
`i_max_uses_count` int(11) NULL DEFAULT 0 COMMENT '0 => Unlimited',
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_order_details` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_order_id` int(11) NOT NULL,
`fk_i_product_id` int(11) NOT NULL,
`d_quantity` double(10,2) NOT NULL,
`d_unit_price` double(10,2) NOT NULL,
`d_tax_percentage` double(10,2) NULL DEFAULT NULL,
`d_total_tax` double(10,2) NULL DEFAULT NULL,
`d_total_price` double(10,2) NOT NULL,
`s_currency_code` varchar(3) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_order` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`i_type` int(1) NOT NULL COMMENT '1=>Buy, 2=>Sell, 3=>ReturnFromSupplier',
`fk_i_user_id` int(11) NOT NULL,
`fk_i_coupon_id` int(11) NULL DEFAULT NULL,
`s_invoice_number` varchar(32) NULL,
`i_products_count` int(11) NOT NULL,
`d_total_delivery` double(10,2) NOT NULL,
`d_total_tax` double(10,2) NOT NULL,
`d_total_discount` double(10,2) NOT NULL,
`d_total_price` double(11,2) NOT NULL,
`s_currency_code` varchar(3) NOT NULL,
`dt_delivery_date` datetime NULL DEFAULT NULL,
`d_location_latitude` double(11,8) NULL DEFAULT NULL,
`d_location_longitude` double(11,8) NULL DEFAULT NULL,
`s_notes` text NULL,
`fk_i_shipping_province_id` int(11) NULL DEFAULT NULL,
`fk_i_shipping_city_id` int(11) NULL DEFAULT NULL,
`s_shipping_address` varchar(255) NULL DEFAULT NULL,
`s_shipping_address_two` varchar(255) NULL DEFAULT NULL,
`s_shipping_address_three` varchar(255) NULL DEFAULT NULL,
`s_shipping_zip` varchar(255) NULL DEFAULT NULL,
`i_status` int(11) NOT NULL DEFAULT 1,
`dt_status_date` datetime NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_product_resource` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_product_id` int(11) NOT NULL,
`s_directory` varchar(255) NULL DEFAULT NULL,
`s_name` varchar(255) NOT NULL,
`i_type` int(11) NOT NULL DEFAULT 0,
`i_file_size` int(11) NULL DEFAULT NULL,
`d_width` double(10,2) NULL DEFAULT NULL,
`d_height` double(10,2) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_unit` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_warehouse` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_product_warehouse` (
`fk_i_product_id` int(11) NOT NULL,
`fk_i_warehouse_id` int(11) NOT NULL,
`d_quantity` double(11,2) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`fk_i_product_id`, `fk_i_warehouse_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_settings` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_key` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`s_value` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`s_extra_1` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`s_extra_2` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`s_extra_3` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`s_extra_4` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`i_sort` int(11) NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Compact
;
CREATE TABLE `t_category_tax` (
`fk_i_category_id` int(11) NOT NULL,
`fk_i_tax_id` int(11) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`fk_i_category_id`, `fk_i_tax_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_product_unit` (
`fk_i_product_id` int(11) NOT NULL,
`fk_i_unit_id` int(11) NOT NULL,
`s_barcode` varchar(255) NULL,
`d_quantity` double(11,2) NULL DEFAULT NULL,
`d_price_old` double(10,2) NULL DEFAULT NULL,
`d_price` double(10,2) NOT NULL,
`s_currency_code` varchar(3) NOT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`fk_i_product_id`, `fk_i_unit_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_delivery_fee` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`s_name` varchar(255) NOT NULL,
`d_price` double(10,2) NOT NULL,
`s_currency_code` varchar(3) NOT NULL,
`b_default` int(1) NULL DEFAULT 0,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_notification` (
`pk_i_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_i_user_id` int(11) NOT NULL,
`fk_i_template_id` int(11) NULL DEFAULT NULL,
`fk_i_order_id` int(11) NULL DEFAULT NULL,
`i_target_users_type` int(11) NULL DEFAULT 2 COMMENT '0=>UNKOWN, 1=>AllUsers, 2=>GroupOfUsers',
`s_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`i_action` int(11) NULL DEFAULT NULL COMMENT '0=>NONE, 1=>OPEN_URL, 2=>OPEN_BROWSER, 3=>OPEN_WEBVIEW',
`s_action_url` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`b_enabled` int(1) NOT NULL DEFAULT 1,
`dt_created_date` datetime NOT NULL,
`dt_modified_date` datetime NULL DEFAULT NULL,
`dt_deleted_date` datetime NULL DEFAULT NULL,
PRIMARY KEY (`pk_i_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;
CREATE TABLE `t_notification_users` (
`fk_i_notification_id` int(11) NOT NULL,
`fk_i_user_id` int(11) NOT NULL,
`b_pushed` int(1) NOT NULL DEFAULT 0,
`dt_seen_date` datetime NULL DEFAULT NULL,
`dt_created_date` datetime NOT NULL,
PRIMARY KEY (`fk_i_notification_id`, `fk_i_user_id`)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
AVG_ROW_LENGTH = 0
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
KEY_BLOCK_SIZE = 0
MAX_ROWS = 0
MIN_ROWS = 0
ROW_FORMAT = Dynamic
;

ALTER TABLE `t_category` ADD CONSTRAINT `fk_t_category_t_category_1` FOREIGN KEY (`fk_i_parent_id`) REFERENCES `t_category` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_category_statistics` ADD CONSTRAINT `fk_t_category_statistics_t_category_1` FOREIGN KEY (`fk_i_category_id`) REFERENCES `t_category` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_comment` ADD CONSTRAINT `fk_t_comment_t_topic_1` FOREIGN KEY (`fk_i_topic_id`) REFERENCES `t_product` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `t_comment` ADD CONSTRAINT `fk_t_comment_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `t_comment_statistics` ADD CONSTRAINT `t_comment_statistics_ibfk_1` FOREIGN KEY (`fk_i_comment_id`) REFERENCES `t_comment` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_notification_summary` ADD CONSTRAINT `t_notification_summary_ibfk_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_resource_relation` ADD CONSTRAINT `aaaa` FOREIGN KEY (`fk_i_resource_id`) REFERENCES `t_resource` (`pk_i_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE `t_spam_relation` ADD CONSTRAINT `fk_t_spam_relation_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_tag_relation` ADD CONSTRAINT `fk_t_tag_relation_t_tag_1` FOREIGN KEY (`fk_i_tag_id`) REFERENCES `t_tag` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_tag_statistics` ADD CONSTRAINT `fk_v_tag_statistics_t_tag_1` FOREIGN KEY (`fk_i_tag_id`) REFERENCES `t_tag` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_product` ADD CONSTRAINT `fk_t_topic_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_product` ADD CONSTRAINT `t_topic_ibfk_1` FOREIGN KEY (`fk_i_category_id`) REFERENCES `t_category` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_product_statistics` ADD CONSTRAINT `fk_t_topic_statistics_t_topic_1` FOREIGN KEY (`fk_i_product_id`) REFERENCES `t_product` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user` ADD CONSTRAINT `fk_t_user_t_user_role_1` FOREIGN KEY (`fk_i_role_id`) REFERENCES `t_user_role` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user_device` ADD CONSTRAINT `fk_t_user_device_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user_forget_password` ADD CONSTRAINT `fk_t_user_forgot_password_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user_provider` ADD CONSTRAINT `fk_t_user_provider_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user_social_relation` ADD CONSTRAINT `fk_t_user_social_relation_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user_statistics` ADD CONSTRAINT `fk_t_user_statistics_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user_verification` ADD CONSTRAINT `fk_t_user_verification_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_user_verification_log` ADD CONSTRAINT `t_user_verification_log_ibfk_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE `t_province` ADD CONSTRAINT `fk_t_province_t_country_1` FOREIGN KEY (`fk_i_country_id`) REFERENCES `t_country` (`pk_i_id`);
ALTER TABLE `t_city` ADD CONSTRAINT `fk_t_city_t_province_1` FOREIGN KEY (`fk_i_province_id`) REFERENCES `t_province` (`pk_i_id`);
ALTER TABLE `t_country` ADD CONSTRAINT `fk_t_country_t_continent_1` FOREIGN KEY (`fk_i_continent_id`) REFERENCES `t_continent` (`pk_i_id`);
ALTER TABLE `t_address` ADD CONSTRAINT `fk_t_address_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`);
ALTER TABLE `t_product_supplier` ADD CONSTRAINT `fk_t_topic_supplier_t_topic_1` FOREIGN KEY (`fk_i_product_id`) REFERENCES `t_product` (`pk_i_id`);
ALTER TABLE `t_order_details` ADD CONSTRAINT `fk_t_order_details_t_order_1` FOREIGN KEY (`fk_i_order_id`) REFERENCES `t_order` (`pk_i_id`);
ALTER TABLE `t_order` ADD CONSTRAINT `fk_t_order_t_coupon_1` FOREIGN KEY (`fk_i_coupon_id`) REFERENCES `t_coupon` (`pk_i_id`);
ALTER TABLE `t_product_resource` ADD CONSTRAINT `fk_t_product_resource_t_topic_1` FOREIGN KEY (`fk_i_product_id`) REFERENCES `t_product` (`pk_i_id`);
ALTER TABLE `t_order_details` ADD CONSTRAINT `fk_t_order_sell_details_t_product_1` FOREIGN KEY (`fk_i_product_id`) REFERENCES `t_product` (`pk_i_id`);
ALTER TABLE `t_order` ADD CONSTRAINT `fk_t_order_sell_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`);
ALTER TABLE `t_product_warehouse` ADD CONSTRAINT `fk_t_product_warehouse_t_product_1` FOREIGN KEY (`fk_i_product_id`) REFERENCES `t_product` (`pk_i_id`);
ALTER TABLE `t_product_warehouse` ADD CONSTRAINT `fk_t_product_warehouse_t_warehouse_1` FOREIGN KEY (`fk_i_warehouse_id`) REFERENCES `t_warehouse` (`pk_i_id`);
ALTER TABLE `t_product_supplier` ADD CONSTRAINT `fk_t_product_supplier_t_user_1` FOREIGN KEY (`fk_i_user_supplier_id`) REFERENCES `t_user` (`pk_i_id`);
ALTER TABLE `t_address` ADD CONSTRAINT `fk_t_address_t_country_1` FOREIGN KEY (`fk_i_country_id`) REFERENCES `t_country` (`pk_i_id`);
ALTER TABLE `t_address` ADD CONSTRAINT `fk_t_address_t_province_1` FOREIGN KEY (`fk_i_province_id`) REFERENCES `t_province` (`pk_i_id`);
ALTER TABLE `t_address` ADD CONSTRAINT `fk_t_address_t_city_1` FOREIGN KEY (`fk_i_city_id`) REFERENCES `t_city` (`pk_i_id`);
ALTER TABLE `t_category_tax` ADD CONSTRAINT `fk_t_product_tax_t_tax_1` FOREIGN KEY (`fk_i_tax_id`) REFERENCES `t_tax` (`pk_i_id`);
ALTER TABLE `t_product_unit` ADD CONSTRAINT `fk_t_product_unit_t_product_1` FOREIGN KEY (`fk_i_product_id`) REFERENCES `t_product` (`pk_i_id`);
ALTER TABLE `t_product_unit` ADD CONSTRAINT `fk_t_product_unit_t_unit_1` FOREIGN KEY (`fk_i_unit_id`) REFERENCES `t_unit` (`pk_i_id`);
ALTER TABLE `t_category_tax` ADD CONSTRAINT `fk_t_category_tax_t_category_1` FOREIGN KEY (`fk_i_category_id`) REFERENCES `t_category` (`pk_i_id`);
ALTER TABLE `t_product` ADD CONSTRAINT `fk_t_product_t_brand_1` FOREIGN KEY (`fk_i_brand_id`) REFERENCES `t_brand` (`pk_i_id`);
ALTER TABLE `t_notification_users` ADD CONSTRAINT `fk_t_notification_users_t_notification_1` FOREIGN KEY (`fk_i_notification_id`) REFERENCES `t_notification` (`pk_i_id`);
ALTER TABLE `t_notification_users` ADD CONSTRAINT `fk_t_notification_users_t_user_1` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`);
ALTER TABLE `t_notification` ADD CONSTRAINT `fk_t_notification_t_notification_template_1` FOREIGN KEY (`fk_i_template_id`) REFERENCES `t_notification_template` (`pk_i_id`);
ALTER TABLE `t_notification` ADD CONSTRAINT `fk_t_notification_t_user_2` FOREIGN KEY (`fk_i_user_id`) REFERENCES `t_user` (`pk_i_id`);

