| @@ -16,9 +16,11 @@ | ||
| 16 | 16 | $table = $wpdb->prefix . 'fbs_board_terms'; |
| 17 | 17 | /* |
| 18 | 18 | * This Schema is for the Board Labels and Stages |
| 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 | `board_id` INT UNSIGNED NOT NULL, |
| 24 | 26 | `title` VARCHAR(100) NULL COMMENT 'Title of the stage or label. Incase of label tile can be null with color only', |
| @@ -30,8 +32,9 @@ | ||
| 30 | 32 | `settings` TEXT NULL COMMENT 'Serialized Settings', |
| 31 | 33 | `archived_at` TIMESTAMP NULL, |
| 32 | 34 | `created_at` TIMESTAMP NULL, |
| 33 | 35 | `updated_at` TIMESTAMP NULL, |
| 36 | + KEY `fbs_board_type` (`board_id`, `type`), | |
| 34 | 37 | KEY `title` (`title`), |
| 35 | 38 | KEY `type` (`type`), |
| 36 | 39 | KEY `position` (`position`), |
| 37 | 40 | KEY `slug` (`slug`) |
| @@ -40,14 +43,18 @@ | ||
| 40 | 43 | dbDelta($sql); |
| 41 | 44 | } else { |
| 42 | 45 | // change column type from int to decimal - for already installed sites |
| 43 | 46 | $column_name = 'position'; |
| 47 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name and column name cannot be prepared | |
| 44 | 48 | $preparedQuery = $wpdb->prepare("DESCRIBE $table %s", $column_name); |
| 49 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Variable contains prepared query, schema check, caching not applicable | |
| 45 | 50 | $dataType = $wpdb->get_row($preparedQuery); |
| 46 | 51 | if (strpos($dataType->Type, 'int') !== false) { |
| 47 | 52 | $sql = $wpdb->prepare( |
| 53 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name and column name cannot be prepared | |
| 48 | 54 | "ALTER TABLE $table MODIFY $column_name decimal(10,2) NOT NULL DEFAULT '1' COMMENT 'Position: 1 = top/first, 2 = second/second in top, etc.';" |
| 49 | 55 | ); |
| 56 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Variable contains prepared query, schema modification, caching not applicable | |
| 50 | 57 | $wpdb->query($sql); |
| 51 | 58 | } |
| 52 | 59 | } |
| 53 | 60 | |