PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / trunk
Fluent Support – Helpdesk & Customer Support Ticket System vtrunk
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / database / Migrations / NotificationUsersMigrator.php

NotificationUsersMigrator.php in Fluent Support – Helpdesk & Customer Support Ticket System trunk, at database/Migrations/NotificationUsersMigrator.php

39 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 FluentSupport\Database\Migrations;
4
5 class NotificationUsersMigrator
6 {
7 static $tableName = 'fs_notification_users';
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) {
17 $sql = "CREATE TABLE $table (
18 `id` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
19 `notification_id` BIGINT(20) UNSIGNED NOT NULL,
20 `user_id` BIGINT(20) UNSIGNED NOT NULL,
21 `channel` VARCHAR(100) NOT NULL DEFAULT 'web',
22 `is_read` TINYINT(1) NOT NULL DEFAULT 0,
23 `read_at` TIMESTAMP NULL,
24 `created_at` TIMESTAMP NULL,
25 `updated_at` TIMESTAMP NULL,
26 INDEX `idx_notification_id` (`notification_id`),
27 INDEX `idx_user_id` (`user_id`),
28 INDEX `idx_user_is_read_created_at` (`user_id`, `is_read`, `created_at`),
29 INDEX `idx_user_notification_id` (`user_id`, `notification_id`),
30 UNIQUE KEY `uniq_notification_user` (`notification_id`, `user_id`)
31 ) $charsetCollate;";
32
33 return dbDelta($sql);
34 }
35
36 return false;
37 }
38 }
39