PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 1.23
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v1.23
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 / TaskMigrator.php

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

71 lines 3.2 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 TaskMigrator
6 {
7 /**
8 * Task Management Table.
9 *
10 * @param bool $isForced
11 * @return void
12 */
13 public static function migrate($isForced = true)
14 {
15 global $wpdb;
16
17 $charsetCollate = $wpdb->get_charset_collate();
18 $table = $wpdb->prefix . 'fbs_tasks';
19
20 if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $table)) != $table || $isForced) {
21 $sql = "CREATE TABLE $table (
22 `id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
23 `parent_id` INT UNSIGNED NULL COMMENT 'Parent task_id if Subtask',
24 `board_id` INT UNSIGNED NULL,
25 `crm_contact_id` BIGINT UNSIGNED NULL COMMENT 'User ID, Contact ID, Deal ID, Subscriber ID etc.',
26 `title` TEXT NULL COMMENT 'Title or Name of the Task , It can be longer than 255 characters.',
27 `slug` VARCHAR(255) NULL,
28 `type` VARCHAR(50) NULL COMMENT 'task, deal, idea, to-do etc.',
29 `status` VARCHAR(50) NULL DEFAULT 'open' COMMENT 'open, completed, for Boards, Won or Lost for Pipelines',
30 `stage_id` INT UNSIGNED NULL,
31 `source` VARCHAR(50) NULL DEFAULT 'web' COMMENT 'web, funnel, contact-section etc.',
32 `source_id` VARCHAR(255) NULL,
33 `priority` VARCHAR(50) NULL DEFAULT 'low' COMMENT 'low, medium, high',
34 `description` LONGTEXT NULL,
35 `lead_value` DECIMAL(10,2) DEFAULT 0.00,
36 `created_by` BIGINT UNSIGNED NULL,
37 `position` decimal(10,2) NOT NULL DEFAULT '1' COMMENT 'Position of the stage or label. 1 = first, 2 = second, etc.',
38 `comments_count` INT UNSIGNED NULL DEFAULT 0,
39 `issue_number` INT UNSIGNED NULL COMMENT 'Board Specific Issue Number to track the task',
40 `reminder_type` VARCHAR(100) NULL DEFAULT 'none',
41 `settings` TEXT NULL COMMENT 'Serialized',
42 `remind_at` TIMESTAMP NULL,
43 `started_at` TIMESTAMP NULL,
44 `due_at` TIMESTAMP NULL,
45 `last_completed_at` TIMESTAMP NULL,
46 `archived_at` TIMESTAMP NULL,
47 `created_at` TIMESTAMP NULL,
48 `updated_at` TIMESTAMP NULL,
49 KEY `type` (`type`),
50 KEY `board_id` (`board_id`),
51 KEY `slug` (`slug`),
52 KEY `comments_count` (`comments_count`),
53 KEY `issue_number` (`issue_number`),
54 KEY `crm_contact_id` (`crm_contact_id`),
55 KEY `due_at` (`due_at`),
56 KEY `priority` (`priority`)
57 ) $charsetCollate;";
58 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
59 dbDelta($sql);
60 } else {
61 $column_name = 'source_id';
62 $preparedQuery = $wpdb->prepare("DESCRIBE $table %s", $column_name);
63 $dataType = $wpdb->get_row($preparedQuery);
64 if (strpos($dataType->Type, 'int') !== false) {
65 $sql = $wpdb->prepare("ALTER TABLE $table MODIFY $column_name VARCHAR(255) NULL");
66 $wpdb->query($sql);
67 }
68 }
69 }
70 }
71