{"record":{"id":"c5438c57e05dfb1c","repo":"yiisoft/yii2","slug":"cubrid-does-not-support-check-constraints","errorCode":null,"errorMessage":"CUBRID does not support check constraints.","messagePattern":"CUBRID does not support check constraints\\.","errorType":"exception","errorClass":"yii\\base\\NotSupportedException","httpStatus":null,"severity":"error","filePath":"framework/db/cubrid/Schema.php","lineNumber":232,"sourceCode":"    {\n        return $this->loadTableConstraints($tableName, 'indexes');\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    protected function loadTableUniques($tableName)\n    {\n        return $this->loadTableConstraints($tableName, 'uniques');\n    }\n\n    /**\n     * {@inheritdoc}\n     * @throws NotSupportedException if this method is called.\n     */\n    protected function loadTableChecks($tableName)\n    {\n        throw new NotSupportedException('CUBRID does not support check constraints.');\n    }\n\n    /**\n     * {@inheritdoc}\n     * @throws NotSupportedException if this method is called.\n     */\n    protected function loadTableDefaultValues($tableName)\n    {\n        throw new NotSupportedException('CUBRID does not support default value constraints.');\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function releaseSavepoint($name)\n    {\n        // does nothing as cubrid does not support this\n    }","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/db/cubrid/Schema.php#L214-L250","documentation":"yii\\db\\cubrid\\Schema::loadTableChecks() (framework/db/cubrid/Schema.php:232) is the metadata loader behind Schema::getTableChecks() and throws NotSupportedException unconditionally — Yii's CUBRID driver cannot read CHECK constraints from the catalog. Any code introspecting check constraints, including tools that iterate all constraint kinds (uniques, checks, defaults), aborts with 'CUBRID does not support check constraints'.","triggerScenarios":"$db->schema->getTableChecks('product'); introspection or model-generation tooling that loops over constraint types; generic schema-diff/reporting utilities run against CUBRID.","commonSituations":"Schema-introspection utilities originally written for MySQL/PostgreSQL deployed on CUBRID; code generators (Gii-like tooling) enumerating constraints; multi-DBMS products with a single introspection path.","solutions":["Skip check-constraint introspection when $db->driverName === 'cubrid' (or getDriverName() of the schema)","Catch yii\\db\\NotSupportedException and treat the check list as empty","If needed, query CUBRID's catalog directly with raw SQL via createCommand()"],"exampleFix":"// before\n$checks = $db->schema->getTableChecks('product'); // throws on CUBRID\n\n// after\ntry {\n    $checks = $db->schema->getTableChecks('product');\n} catch (\\yii\\db\\NotSupportedException $e) {\n    $checks = []; // CUBRID driver cannot load check constraints\n}","handlingStrategy":"try-catch","validationCode":"$checks = [];\nif ($db->driverName !== 'cubrid') {\n    $checks = $db->schema->getTableChecks($tableName);\n}","typeGuard":null,"tryCatchPattern":"try {\n    $checks = $db->schema->getTableChecks($tableName);\n} catch (\\yii\\db\\NotSupportedException $e) {\n    $checks = []; // CUBRID driver cannot load check constraints\n}","preventionTips":["Feature-detect by driver before schema introspection loops","Wrap generic introspection utilities so one missing capability does not abort the run","Model constraints defensively: unknown does not mean absent"],"tags":["yii2","cubrid","database","schema","introspection","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"}