{"record":{"id":"6d95c3257db3dda3","repo":"yiisoft/yii2","slug":"yii-db-cubrid-querybuilder-dropcheck-is-not-suppo","errorCode":null,"errorMessage":"yii\\db\\cubrid\\QueryBuilder::dropCheck is not supported by CUBRID.","messagePattern":"yii\\\\db\\\\cubrid\\\\QueryBuilder::dropCheck is not supported by CUBRID\\.","errorType":"exception","errorClass":"yii\\base\\NotSupportedException","httpStatus":null,"severity":"error","filePath":"framework/db/cubrid/QueryBuilder.php","lineNumber":213,"sourceCode":"        return 'DROP INDEX ' . $this->db->quoteTableName($name) . ' ON ' . $this->db->quoteTableName($table);\n    }\n\n    /**\n     * {@inheritdoc}\n     * @throws NotSupportedException this is not supported by CUBRID.\n     */\n    public function addCheck($name, $table, $expression)\n    {\n        throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.');\n    }\n\n    /**\n     * {@inheritdoc}\n     * @throws NotSupportedException this is not supported by CUBRID.\n     */\n    public function dropCheck($name, $table)\n    {\n        throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.');\n    }\n\n    /**\n     * {@inheritdoc}\n     * @since 2.0.8\n     */\n    public function addCommentOnColumn($table, $column, $comment)\n    {\n        $definition = $this->getColumnDefinition($table, $column);\n        $definition = trim(preg_replace(\"/COMMENT '(.*?)'/i\", '', $definition));\n\n        return 'ALTER TABLE ' . $this->db->quoteTableName($table)\n        . ' CHANGE ' . $this->db->quoteColumnName($column)\n        . ' ' . $this->db->quoteColumnName($column)\n        . (empty($definition) ? '' : ' ' . $definition)\n        . ' COMMENT ' . $this->db->quoteValue($comment);\n    }\n","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/db/cubrid/QueryBuilder.php#L195-L231","documentation":"yii\\db\\cubrid\\QueryBuilder::dropCheck() (framework/db/cubrid/QueryBuilder.php:213) is the drop counterpart of addCheck() and likewise throws NotSupportedException unconditionally — the CUBRID builder cannot remove CHECK constraints. Because addCheck() also never succeeded on CUBRID, a migration that symmetrically adds and drops checks will fail on both ends when run against a CUBRID connection.","triggerScenarios":"A migration's down() calls $this->dropCheck('chk_price','product') on a CUBRID connection; down migrations generated to mirror check constraints created elsewhere.","commonSituations":"Rolling back a cross-DBMS migration on CUBRID; CI running migrate/down as a smoke test; symmetrical migration scaffolding that assumes every driver supports every operation.","solutions":["Guard by driver: if ($this->db->driverName !== 'cubrid') { $this->dropCheck(...); }","Catch yii\\db\\NotSupportedException in safeDown() and return false or skip gracefully","Since checks can never have been added on CUBRID, make dropCheck a no-op for that driver rather than an error path"],"exampleFix":"// before\npublic function safeDown()\n{\n    $this->dropCheck('chk_price', 'product'); // throws NotSupportedException on CUBRID\n}\n\n// after\npublic function safeDown()\n{\n    if ($this->db->driverName !== 'cubrid') {\n        $this->dropCheck('chk_price', 'product');\n    }\n}","handlingStrategy":"try-catch","validationCode":"if ($this->db->driverName !== 'cubrid') {\n    $this->dropCheck('chk_price', 'product');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $this->dropCheck('chk_price', 'product');\n} catch (\\yii\\db\\NotSupportedException $e) {\n    // addCheck() never succeeded on this driver either — nothing to drop\n    \\Yii::info($e->getMessage(), __METHOD__);\n}","preventionTips":["Make down() migrations mirror the driver guards used in up()","Treat NotSupportedException on schema ops as 'no-op needed', not as a failure to report","Smoke-test migrate/up + migrate/down on every DBMS in your support matrix"],"tags":["yii2","cubrid","database","migration","check-constraint","not-supported"],"backgroundTag":"unsupported-database-feature","analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}