| @@ -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', |
| @@ -40,14 +42,18 @@ | ||
| 40 | 42 | dbDelta($sql); |
| 41 | 43 | } else { |
| 42 | 44 | // change column type from int to decimal - for already installed sites |
| 43 | 45 | $column_name = 'position'; |
| 46 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name and column name cannot be prepared | |
| 44 | 47 | $preparedQuery = $wpdb->prepare("DESCRIBE $table %s", $column_name); |
| 48 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Variable contains prepared query, schema check, caching not applicable | |
| 45 | 49 | $dataType = $wpdb->get_row($preparedQuery); |
| 46 | 50 | if (strpos($dataType->Type, 'int') !== false) { |
| 47 | 51 | $sql = $wpdb->prepare( |
| 52 | + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name and column name cannot be prepared | |
| 48 | 53 | "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 | 54 | ); |
| 55 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Variable contains prepared query, schema modification, caching not applicable | |
| 50 | 56 | $wpdb->query($sql); |
| 51 | 57 | } |
| 52 | 58 | } |
| 53 | 59 | |