| @@ -16,9 +16,11 @@ | ||
| 16 | 16 | |
| 17 | 17 | $charsetCollate = $wpdb->get_charset_collate(); |
| 18 | 18 | $table = $wpdb->prefix . 'fbs_tasks'; |
| 19 | 19 | |
| 20 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Schema check query, caching not applicable for migrations | |
| 20 | 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 | |
| 21 | 23 | $sql = "CREATE TABLE $table ( |
| 22 | 24 | `id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 23 | 25 | `parent_id` INT UNSIGNED NULL COMMENT 'Parent task_id if Subtask', |
| 24 | 26 | `board_id` INT UNSIGNED NULL, |
| @@ -29,9 +31,9 @@ | ||
| 29 | 31 | `status` VARCHAR(50) NULL DEFAULT 'open' COMMENT 'open, completed, for Boards, Won or Lost for Pipelines', |
| 30 | 32 | `stage_id` INT UNSIGNED NULL, |
| 31 | 33 | `source` VARCHAR(50) NULL DEFAULT 'web' COMMENT 'web, funnel, contact-section etc.', |
| 32 | 34 | `source_id` VARCHAR(255) NULL, |
| 33 | - `priority` VARCHAR(50) NULL DEFAULT 'low' COMMENT 'low, medium, high', | |
| 35 | + `priority` VARCHAR(50) NULL DEFAULT NULL COMMENT 'urgent, high, medium, low', | |
| 34 | 36 | `description` LONGTEXT NULL, |
| 35 | 37 | `lead_value` DECIMAL(10,2) DEFAULT 0.00, |
| 36 | 38 | `created_by` BIGINT UNSIGNED NULL, |
| 37 | 39 | `position` decimal(10,2) NOT NULL DEFAULT '1' COMMENT 'Position of the stage or label. 1 = first, 2 = second, etc.', |
| @@ -58,13 +60,18 @@ | ||
| 58 | 60 | require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
| 59 | 61 | dbDelta($sql); |
| 60 | 62 | } else { |
| 61 | 63 | $column_name = 'source_id'; |
| 64 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name and column name cannot be prepared | |
| 62 | 65 | $preparedQuery = $wpdb->prepare("DESCRIBE $table %s", $column_name); |
| 66 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Variable contains prepared query, schema check, caching not applicable | |
| 63 | 67 | $dataType = $wpdb->get_row($preparedQuery); |
| 64 | 68 | if (strpos($dataType->Type, 'int') !== false) { |
| 69 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name and column name cannot be prepared | |
| 65 | 70 | $sql = $wpdb->prepare("ALTER TABLE $table MODIFY $column_name VARCHAR(255) NULL"); |
| 71 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Variable contains prepared query, schema modification, caching not applicable | |
| 66 | 72 | $wpdb->query($sql); |
| 67 | 73 | } |
| 68 | 74 | } |
| 75 | + | |
| 69 | 76 | } |
| 70 | 77 | } |