PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 All 83 releases
yatra / app / Database / Tables / DeparturesTable.php

DeparturesTable.php in Yatra – Travel Booking & Tour Operator Software trunk, at app/Database/Tables/DeparturesTable.php

65 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yatra\Database\Tables;
4
5 /**
6 * Departures Table
7 *
8 * Handles trip departures table operations
9 * Table: wp_yatra_trip_departures
10 */
11 class DeparturesTable extends BaseTable
12 {
13 /**
14 * Table name without prefix
15 */
16 protected static string $table = 'yatra_trip_departures';
17
18 /**
19 * Get table name
20 */
21 public static function getTableName(): string
22 {
23 global $wpdb;
24 return $wpdb->prefix . static::$table;
25 }
26
27 /**
28 * Get table schema
29 */
30 public static function getSchema(): string
31 {
32 global $wpdb;
33 $table = static::getTableName();
34 $charset_collate = $wpdb->get_charset_collate();
35
36 return "
37 CREATE TABLE IF NOT EXISTS `{$table}` (
38 `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
39 `trip_id` bigint(20) UNSIGNED NOT NULL,
40 `date` date NOT NULL COMMENT 'Legacy single-day key — keep in sync with start_date',
41 `start_date` date DEFAULT NULL COMMENT 'Trip start (booking / calendar)',
42 `end_date` date DEFAULT NULL COMMENT 'Trip end (multi-day)',
43 `time` time DEFAULT NULL,
44 `max_capacity` int(11) NOT NULL DEFAULT 0,
45 `booked_count` int(11) NOT NULL DEFAULT 0,
46 `total_revenue` decimal(12,2) NOT NULL DEFAULT 0.00,
47 `status` varchar(20) NOT NULL DEFAULT 'upcoming',
48 `source` varchar(20) NOT NULL DEFAULT 'manual',
49 `price_override` decimal(10,2) DEFAULT NULL,
50 `price_by_traveler_type` longtext DEFAULT NULL,
51 `notes` text DEFAULT NULL,
52 `created_at` datetime NOT NULL,
53 `updated_at` datetime DEFAULT NULL,
54 PRIMARY KEY (`id`),
55 KEY `date` (`date`),
56 KEY `start_date` (`start_date`),
57 KEY `status` (`status`),
58 KEY `trip_date` (`trip_id`, `date`),
59 KEY `trip_start` (`trip_id`, `start_date`),
60 KEY `idx_trip_status` (`trip_id`, `status`)
61 ) {$charset_collate};
62 ";
63 }
64 }
65