yiisoft/yii2 · error · yii\base\NotSupportedException
yii\db\cubrid\QueryBuilder::dropCheck is not supported by CU
Error message
yii\db\cubrid\QueryBuilder::dropCheck is not supported by CUBRID.
What it means
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.
Source
Thrown at framework/db/cubrid/QueryBuilder.php:213
return 'DROP INDEX ' . $this->db->quoteTableName($name) . ' ON ' . $this->db->quoteTableName($table);
}
/**
* {@inheritdoc}
* @throws NotSupportedException this is not supported by CUBRID.
*/
public function addCheck($name, $table, $expression)
{
throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.');
}
/**
* {@inheritdoc}
* @throws NotSupportedException this is not supported by CUBRID.
*/
public function dropCheck($name, $table)
{
throw new NotSupportedException(__METHOD__ . ' is not supported by CUBRID.');
}
/**
* {@inheritdoc}
* @since 2.0.8
*/
public function addCommentOnColumn($table, $column, $comment)
{
$definition = $this->getColumnDefinition($table, $column);
$definition = trim(preg_replace("/COMMENT '(.*?)'/i", '', $definition));
return 'ALTER TABLE ' . $this->db->quoteTableName($table)
. ' CHANGE ' . $this->db->quoteColumnName($column)
. ' ' . $this->db->quoteColumnName($column)
. (empty($definition) ? '' : ' ' . $definition)
. ' COMMENT ' . $this->db->quoteValue($comment);
}
View on GitHub (pinned to 66f00d18a2)
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
Example fix
// before
public function safeDown()
{
$this->dropCheck('chk_price', 'product'); // throws NotSupportedException on CUBRID
}
// after
public function safeDown()
{
if ($this->db->driverName !== 'cubrid') {
$this->dropCheck('chk_price', 'product');
}
} Defensive patterns
Strategy: try-catch
Validate before calling
if ($this->db->driverName !== 'cubrid') {
$this->dropCheck('chk_price', 'product');
} Try / catch
try {
$this->dropCheck('chk_price', 'product');
} catch (\yii\db\NotSupportedException $e) {
// addCheck() never succeeded on this driver either — nothing to drop
\Yii::info($e->getMessage(), __METHOD__);
} Prevention
- 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
When it happens
Trigger: A migration's down() calls $this->dropCheck('chk_price','product') on a CUBRID connection; down migrations generated to mirror check constraints created elsewhere.
Common situations: 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.
Related errors
- yii\db\cubrid\QueryBuilder::addCheck is not supported by CUB
- CUBRID does not support check constraints.
- Unable to find column '$column' in table '$table'.
- CUBRID does not support default value constraints.
- Oracle does not support ON UPDATE clause.
AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17).
Data as JSON: /api/errors/6d95c3257db3dda3.
Report an issue: GitHub.