PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
fluent-cart / database / Migrations / ProductReviewsMigrator.php

ProductReviewsMigrator.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.7.0, at database/Migrations/ProductReviewsMigrator.php

41 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\Database\Migrations;
4
5 class ProductReviewsMigrator extends Migrator
6 {
7 public static string $tableName = 'fct_product_reviews';
8
9 public static function getSqlSchema(): string
10 {
11 $indexPrefix = static::getDbPrefix() . 'fct_prev_';
12 return "`id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
13 `parent_id` BIGINT UNSIGNED NULL, -- NULL = a review; set = a reply to that review
14 `post_id` BIGINT UNSIGNED NOT NULL, -- product post ID
15 `item_id` BIGINT UNSIGNED NULL, -- fct_product_variations.id when the review targets one item; NULL = the product
16 `order_id` BIGINT UNSIGNED NULL,
17 `customer_id` BIGINT UNSIGNED NULL,
18 `user_id` BIGINT UNSIGNED NULL,
19 `reviewer_name` VARCHAR(192) NOT NULL DEFAULT '',
20 `reviewer_email` VARCHAR(192) NOT NULL DEFAULT '',
21 `title` VARCHAR(192) NULL,
22 `review` LONGTEXT NULL,
23 `rating` TINYINT UNSIGNED NULL, -- NULL for replies
24 `status` VARCHAR(20) NOT NULL DEFAULT 'pending', -- approved | pending | spam | trash
25 `is_verified` TINYINT(1) NOT NULL DEFAULT 0,
26 `is_admin_reply` TINYINT(1) NOT NULL DEFAULT 0, -- replies can also come from the reviewer (customer follow-up)
27 `media_count` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- maintained on media attach/detach
28 `ip_address` VARCHAR(45) NULL,
29 `other_info` json NULL, -- media refs + extra review data
30 `created_at` DATETIME NULL,
31 `updated_at` DATETIME NULL,
32 INDEX `{$indexPrefix}_post_parent_status_idx` (`post_id` ASC, `parent_id` ASC, `status` ASC),
33 INDEX `{$indexPrefix}_post_media_idx` (`post_id` ASC, `media_count` ASC),
34 INDEX `{$indexPrefix}_customer_id_idx` (`customer_id` ASC),
35 INDEX `{$indexPrefix}_user_parent_created_idx` (`user_id` ASC, `parent_id` ASC, `created_at` ASC),
36 INDEX `{$indexPrefix}_parent_status_id_idx` (`parent_id` ASC, `status` ASC, `id` ASC),
37 INDEX `{$indexPrefix}_email_created_idx` (`reviewer_email` ASC, `created_at` ASC),
38 INDEX `{$indexPrefix}_post_item_parent_status_idx` (`post_id` ASC, `item_id` ASC, `parent_id` ASC, `status` ASC)";
39 }
40 }
41