PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.4.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.4.0
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 / MetaMigrator.php

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

43 lines 1.4 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 MetaMigrator
6 {
7 /**
8 * Migrate the table.
9 *
10 * @return void
11 */
12 public static function migrate()
13 {
14 global $wpdb;
15
16 $charsetCollate = $wpdb->get_charset_collate();
17
18 $table = $wpdb->prefix .'fcal_meta';
19 $indexPrefix = $wpdb->prefix .'fcal_mt_';
20
21 if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $table)) != $table) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery
22 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
23 $sql = "CREATE TABLE $table (
24 `id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
25 `object_type` VARCHAR(50) NOT NULL,
26 `object_id` BIGINT NULL,
27 `key` VARCHAR(192) NOT NULL,
28 `value` LONGTEXT NULL,
29 `created_at` TIMESTAMP NULL,
30 `updated_at` TIMESTAMP NULL,
31 INDEX `{$indexPrefix}_mt_idx` (`object_type` ASC),
32 INDEX `{$indexPrefix}_mto_id_idx` (`object_id` ASC),
33 INDEX `{$indexPrefix}_mto_id_key` (`key` )
34 ) $charsetCollate;";
35
36 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
37
38 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- dbDelta() is the safe schema-change wrapper.
39 dbDelta($sql);
40 }
41 }
42 }
43