# yatra/3.0.14.2/app/Database/Tables/ReviewsTable.php

Yatra – Travel Booking &amp; Tour Operator Software, version 3.0.14.2. 74 lines.

- Page: https://pluginprobe.com/plugins/yatra/3.0.14.2/code/app/Database/Tables/ReviewsTable.php
- Raw: https://pluginprobe.com/plugins/yatra/3.0.14.2/raw/app/Database/Tables/ReviewsTable.php
- Modified: 2026-05-25T04:28:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/yatra/3.0.14.2/code/app/Database/Tables/ReviewsTable.php#L10-L20`.

```php
<?php

namespace Yatra\Database\Tables;

/**
 * Reviews Table Class
 * 
 * Represents the reviews table (wp_yatra_reviews) containing trip review data
 * including ratings, content, author information, status management,
 * and helpful voting.
 * 
 * This table follows the new simplified pattern with only two static methods:
 * - getTableName(): Returns the prefixed table name
 * - getSchema(): Returns the complete CREATE TABLE SQL statement
 * 
 * Usage:
 * ReviewsTable::getTableName()  // Returns 'wp_yatra_reviews'
 * ReviewsTable::getSchema()     // Returns complete SQL schema
 * 
 * @package Yatra\Database\Tables
 * @since 1.0.0
 */
class ReviewsTable extends BaseTable
{
    /**
     * Table name without prefix
     * 
     * @var string The base table name without WordPress prefix
     */
    protected static string $table = 'yatra_reviews';

    /**
     * Get the complete table schema as raw SQL CREATE TABLE statement
     * 
     * Returns the full SQL schema for the reviews table using heredoc syntax
     * for proper IDE syntax highlighting. Includes all columns, indexes,
     * and constraints from the original Database.php schema.
     * 
     * @return string Complete CREATE TABLE SQL statement
     */
    public static function getSchema(): string
    {
        $tableName = static::getTableName();
        $charsetCollate = static::getCharsetCollate();

        return <<<SQL
CREATE TABLE IF NOT EXISTS `{$tableName}` (
    `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `trip_id` bigint(20) UNSIGNED NOT NULL,
    `user_id` bigint(20) UNSIGNED DEFAULT 0,
    `rating` tinyint(1) UNSIGNED NOT NULL,
    `title` varchar(255) DEFAULT NULL,
    `content` text NOT NULL,
    `author_name` varchar(100) NOT NULL,
    `author_email` varchar(100) DEFAULT NULL,
    `author_location` varchar(100) DEFAULT NULL,
    `status` enum('pending','approved','rejected','spam','trash') DEFAULT 'pending',
    `helpful_count` int(11) UNSIGNED DEFAULT 0,
    `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
    `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    `created_by` bigint(20) unsigned DEFAULT NULL COMMENT 'User ID who created this review',
    `updated_by` bigint(20) unsigned DEFAULT NULL COMMENT 'User ID who last updated this review',
    
    PRIMARY KEY (`id`),
    KEY `idx_trip_status` (`trip_id`, `status`),
    KEY `idx_user_id` (`user_id`),
    KEY `idx_status` (`status`),
    KEY `idx_rating` (`rating`),
    KEY `idx_created_at` (`created_at`)
) {$charsetCollate} COMMENT='Trip reviews and ratings';
SQL;
    }
}

```
