PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / trunk
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration vtrunk
2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 1.45 All 41 releases
fluent-boards / database / Migrations / AttachmentMigrator.php

AttachmentMigrator.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration trunk, at database/Migrations/AttachmentMigrator.php

50 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBoards\Database\Migrations;
4
5 class AttachmentMigrator
6 {
7 /**
8 * Attachments Table.
9 * @param bool $isForced
10 * @return void
11 */
12 public static function migrate($isForced = true)
13 {
14 global $wpdb;
15
16 $charsetCollate = $wpdb->get_charset_collate();
17
18 $table = $wpdb->prefix . 'fbs_attachments';
19
20 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Schema check query, caching not applicable for migrations
21 if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $table)) != $table || $isForced) {
22 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- Table name cannot be prepared in CREATE TABLE
23 $sql = "CREATE TABLE $table (
24 `id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
25 `object_id` INT UNSIGNED NOT NULL COMMENT 'Task ID or Comment ID or Board ID',
26 `object_type` VARCHAR(100) DEFAULT 'TASK' COMMENT 'TASK|COMMENT|BOARD',
27 `attachment_type` VARCHAR(100) NULL,
28 `file_path` TEXT NULL,
29 `full_url` TEXT NULL,
30 `settings` TEXT NULL,
31 `title` VARCHAR(192) NULL,
32 `file_hash` VARCHAR(192) NULL,
33 `driver` VARCHAR(100) DEFAULT 'local',
34 `status` VARCHAR(100) NULL DEFAULT 'ACTIVE' COMMENT 'ACTIVE|INACTIVE|DELETED',
35 `file_size` VARCHAR(100) NULL,
36 `created_at` TIMESTAMP NULL,
37 `updated_at` TIMESTAMP NULL,
38 KEY `object_type` (`object_type`),
39 KEY `object_id` (`object_id`),
40 KEY `attachment_type` (`attachment_type`),
41 KEY `status` (`status`),
42 KEY `file_hash` (`file_hash`),
43 KEY `driver` (`driver`)
44 ) $charsetCollate;";
45 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
46 dbDelta($sql);
47 }
48 }
49 }
50