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 / BookingHostMigrator.php

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

37 lines 1.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 BookingHostMigrator
6 {
7 static $tableName = 'fcal_booking_hosts';
8
9 public static function migrate()
10 {
11 global $wpdb;
12
13 $charsetCollate = $wpdb->get_charset_collate();
14 $table = $wpdb->prefix . static::$tableName;
15
16 if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $table)) != $table) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery
17 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
18 $sql = "CREATE TABLE $table (
19 `id` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
20 `booking_id` BIGINT(20) UNSIGNED NOT NULL,
21 `user_id` BIGINT(20) UNSIGNED NOT NULL,
22 `status` VARCHAR(20) NOT NULL DEFAULT 'confirmed',
23 `created_at` TIMESTAMP NULL,
24 `updated_at` TIMESTAMP NULL,
25 KEY `fcal_bu_booking_id` (`booking_id`),
26 KEY `fcal_bu_user_id` (`user_id`),
27 KEY `fcal_bu_status` (`status`)
28 ) $charsetCollate;";
29
30 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
31
32 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- dbDelta() is the safe schema-change wrapper.
33 dbDelta($sql);
34 }
35 }
36 }
37