public function actionClearSchema($db = 'db')
    {
        $connection = $this->app->get($db, false);
        if ($connection === null) {
            $this->stdout("Unknown component \"$db\".\n", Console::FG_RED);
            return ExitCode::UNSPECIFIED_ERROR;
        }

        if (!$connection instanceof \Yiisoft\Db\Connection) {
            $this->stdout("\"$db\" component doesn't inherit \\Yiisoft\\Db\\Connection.\n", Console::FG_RED);
            return ExitCode::UNSPECIFIED_ERROR;
        } elseif (!$this->confirm("Flush cache schema for \"$db\" connection?")) {
            return ExitCode::OK;
        }

        try {
            $schema = $connection->getSchema();
            $schema->refresh();
            $this->stdout("Schema cache for component \"$db\", was flushed.\n\n", Console::FG_GREEN);
        } catch (\Exception $e) {
            $this->stdout($e->getMessage() . "\n\n", Console::FG_RED);
        }
    }
public function actionClearSchema($db = 'db')
    {
        $connection = $this->app->get($db, false);
        if ($connection === null) {
            $this->stdout("Unknown component \"$db\".\n", Console::FG_RED);
            return ExitCode::UNSPECIFIED_ERROR;
        }

        if (!$connection instanceof \Yiisoft\Db\Connection) {
            $this->stdout("\"$db\" component doesn't inherit \\Yiisoft\\Db\\Connection.\n", Console::FG_RED);
            return ExitCode::UNSPECIFIED_ERROR;
        } elseif (!$this->confirm("Flush cache schema for \"$db\" connection?")) {
            return ExitCode::OK;
        }

        try {
            $schema = $connection->getSchema();
            $schema->refresh();
            $this->stdout("Schema cache for component \"$db\", was flushed.\n\n", Console::FG_GREEN);
        } catch (\Exception $e) {
            $this->stdout($e->getMessage() . "\n\n", Console::FG_RED);
        }
    }
public function actionClearSchema ( $ db = 'db' ) { $ connection = $ this -> app -> get ( $ db , false ) ; if ( $ connection === null ) { $ this -> stdout ( "Unknown component \"$db\".\n" , Console :: FG_RED ) ; return ExitCode :: UNSPECIFIED_ERROR ; } if ( ! $ connection instanceof \ Yiisoft \ Db \ Connection ) { $ this -> stdout ( "\"$db\" component doesn't inherit \\Yiisoft\\Db\\Connection.\n" , Console :: FG_RED ) ; return ExitCode :: UNSPECIFIED_ERROR ; } elseif ( ! $ this -> confirm ( "Flush cache schema for \"$db\" connection?" ) ) { return ExitCode :: OK ; } try { $ schema = $ connection -> getSchema ( ) ; $ schema -> refresh ( ) ; $ this -> stdout ( "Schema cache for component \"$db\", was flushed.\n\n" , Console :: FG_GREEN ) ; } catch ( \ Exception $ e ) { $ this -> stdout ( $ e -> getMessage ( ) . "\n\n" , Console :: FG_RED ) ; } }
Clears DB schema cache for a given connection component.

```
# clears cache schema specified by component id: "db"
yii cache/clear-schema db
```

@param string $db id connection component
@return int exit code
@throws Exception
@throws \yii\exceptions\InvalidConfigException

@since 2.0.1
Clears DB schema cache for a given connection component .