| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yatra\Database\Tables; |
| 4 |
|
| 5 |
use Yatra\Database\Tables\BaseTable; |
| 6 |
|
| 7 |
/** |
| 8 |
* Trip Itinerary Days Table Class |
| 9 |
* |
| 10 |
* Stores day information for trip itineraries. Each row represents a day |
| 11 |
* in a trip's itinerary with basic day-level information. |
| 12 |
* |
| 13 |
* @package Yatra\Database\Tables |
| 14 |
* @since 2.0.0 |
| 15 |
*/ |
| 16 |
class TripItineraryDaysTable extends BaseTable |
| 17 |
{ |
| 18 |
/** |
| 19 |
* Table name without prefix |
| 20 |
* |
| 21 |
* @var string The base table name without WordPress prefix |
| 22 |
*/ |
| 23 |
protected static string $table = 'yatra_new_trip_itinerary_days'; |
| 24 |
|
| 25 |
/** |
| 26 |
* Get the complete table schema as raw SQL CREATE TABLE statement |
| 27 |
* |
| 28 |
* @return string Complete CREATE TABLE SQL statement |
| 29 |
*/ |
| 30 |
public static function getSchema(): string |
| 31 |
{ |
| 32 |
$tableName = static::getTableName(); |
| 33 |
$charsetCollate = static::getCharsetCollate(); |
| 34 |
|
| 35 |
return <<<SQL |
| 36 |
CREATE TABLE IF NOT EXISTS `{$tableName}` ( |
| 37 |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
| 38 |
`trip_id` bigint(20) unsigned NOT NULL, |
| 39 |
`day_number` smallint(5) unsigned NOT NULL COMMENT 'Day 1, 2, 3...', |
| 40 |
`title` varchar(255) DEFAULT NULL COMMENT 'Day title', |
| 41 |
`description` text DEFAULT NULL COMMENT 'Day overview', |
| 42 |
`order` smallint(5) unsigned DEFAULT 0, |
| 43 |
`created_at` datetime DEFAULT CURRENT_TIMESTAMP, |
| 44 |
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 45 |
`created_by` bigint(20) unsigned DEFAULT NULL COMMENT 'User ID who created this record', |
| 46 |
`updated_by` bigint(20) unsigned DEFAULT NULL COMMENT 'User ID who last updated this record', |
| 47 |
`metadata` longtext DEFAULT NULL COMMENT 'JSON: Additional metadata for future use', |
| 48 |
PRIMARY KEY (`id`), |
| 49 |
UNIQUE KEY `trip_day` (`trip_id`, `day_number`), |
| 50 |
KEY `trip_id` (`trip_id`), |
| 51 |
KEY `day_number` (`day_number`), |
| 52 |
KEY `order` (`order`), |
| 53 |
KEY `created_at` (`created_at`), |
| 54 |
KEY `updated_at` (`updated_at`) |
| 55 |
) ENGINE=InnoDB {$charsetCollate} COMMENT='Trip itinerary days - day level information'; |
| 56 |
SQL; |
| 57 |
} |
| 58 |
} |
| 59 |
|