PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / database / Migrations / CalendarSlotsMigrator.php

CalendarSlotsMigrator.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution trunk, at database/Migrations/CalendarSlotsMigrator.php

57 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\Database\Migrations;
4
5 class CalendarSlotsMigrator
6 {
7 static $tableName = 'fcal_calendar_events';
8
9 public static function migrate()
10 {
11 global $wpdb;
12
13 $charsetCollate = $wpdb->get_charset_collate();
14
15 $table = $wpdb->prefix . static::$tableName;
16
17 if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $table)) != $table) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery
18 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
19 $sql = "CREATE TABLE $table (
20 `id` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
21 `hash` VARCHAR(192) NULL,
22 `user_id` BIGINT(20) UNSIGNED NOT NULL,
23 `calendar_id` BIGINT(20) UNSIGNED NOT NULL,
24 `duration` INT(11) UNSIGNED NOT NULL,
25 `title` VARCHAR(192) NOT NULL,
26 `slug` VARCHAR(192) NOT NULL,
27 `media_id` BIGINT(20) UNSIGNED,
28 `description` LONGTEXT NULL,
29 `settings` LONGTEXT NULL,
30 `availability_type` VARCHAR(192) DEFAULT 'custom',
31 `availability_id` BIGINT(20) UNSIGNED,
32 `status` VARCHAR(20) NOT NULL DEFAULT 'active',
33 `type` VARCHAR(20) NOT NULL DEFAULT 'free',
34 `color_schema` VARCHAR(100) NOT NULL DEFAULT 'default',
35 `location_type` VARCHAR(100) NOT NULL DEFAULT '',
36 `location_heading` TEXT NULL,
37 `location_settings` LONGTEXT NULL,
38 `event_type` VARCHAR(20) NOT NULL DEFAULT 'single',
39 `is_display_spots` BOOLEAN NOT NULL DEFAULT 0,
40 `max_book_per_slot` INT(10) UNSIGNED NOT NULL DEFAULT 1,
41 `created_at` TIMESTAMP NULL,
42 `updated_at` TIMESTAMP NULL,
43 KEY `fcal_cs_user_id` (`user_id`),
44 KEY `fcal_cs_hash` (`hash`),
45 KEY `fcal_cs_status` (`status`),
46 KEY `fcal_cs_slug` (`slug`),
47 KEY `fcal_cs_type` (`type`)
48 ) $charsetCollate;";
49
50 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
51
52 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- dbDelta() is the safe schema-change wrapper.
53 dbDelta($sql);
54 }
55 }
56 }
57