# Schema

> Schema is the class for retrieving metadata from a SQLite (2/3) database.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [db](/docs/api/yii/db/index.md) › [sqlite](/docs/api/yii/db/sqlite/index.md) › Schema

| class | `yii\db\sqlite\Schema` |
| --- | --- |
| Extends | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) » [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| Implements | [`yii\db\ConstraintFinderInterface`](/docs/api/yii/db/constraintfinderinterface/index.md), [`yii\base\Configurable`](/docs/api/yii/base/configurable/index.md) |
| Uses traits | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| Since | 2.0 |
| Source | [`framework/db/sqlite/Schema.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/db/sqlite/Schema.php#L37) |

Schema is the class for retrieving metadata from a SQLite (2/3) database.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-columnSchemaClass"></span>`$columnSchemaClass` | `class-string<yii\db\T>\|array{class?: class-string<yii\db\T>, __class?: class-string<yii\db\T>}` | Default: `\yii\db\sqlite\ColumnSchema::class`. Available since 2.0.11. | `Schema` |
| <span id="property-db"></span>[`$db`](/docs/api/yii/db/schema/index.md#property-db) | [`yii\db\Connection`](/docs/api/yii/db/connection/index.md) | The database connection Default: `null`. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-defaultSchema"></span>[`$defaultSchema`](/docs/api/yii/db/schema/index.md#property-defaultSchema) | `string` | The default schema name used for the current session. Default: `null`. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-exceptionMap"></span>[`$exceptionMap`](/docs/api/yii/db/schema/index.md#property-exceptionMap) | `array` | Map of DB errors and corresponding exceptions If left part is found in DB error message exception class from the right part is used. Default: `['SQLSTATE[23' => 'yii\db\IntegrityException']`. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-lastInsertID"></span>[`$lastInsertID`](/docs/api/yii/db/schema/index.md#property-lastInsertID) read-only | `string` | The row ID of the last row inserted, or the last value retrieved from the sequence object. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-queryBuilder"></span>[`$queryBuilder`](/docs/api/yii/db/schema/index.md#property-queryBuilder) read-only | `yii\db\TQueryBuilder` | The query builder for this connection. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-schemaChecks"></span>[`$schemaChecks`](/docs/api/yii/db/constraintfindertrait/index.md#property-schemaChecks) read-only | [`yii\db\CheckConstraint`](/docs/api/yii/db/checkconstraint/index.md)`[][]` | Check constraints for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="property-schemaDefaultValues"></span>[`$schemaDefaultValues`](/docs/api/yii/db/constraintfindertrait/index.md#property-schemaDefaultValues) read-only | [`yii\db\DefaultValueConstraint`](/docs/api/yii/db/defaultvalueconstraint/index.md)`[]` | Default value constraints for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="property-schemaForeignKeys"></span>[`$schemaForeignKeys`](/docs/api/yii/db/constraintfindertrait/index.md#property-schemaForeignKeys) read-only | [`yii\db\ForeignKeyConstraint`](/docs/api/yii/db/foreignkeyconstraint/index.md)`[][]` | Foreign keys for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="property-schemaIndexes"></span>[`$schemaIndexes`](/docs/api/yii/db/constraintfindertrait/index.md#property-schemaIndexes) read-only | [`yii\db\IndexConstraint`](/docs/api/yii/db/indexconstraint/index.md)`[][]` | Indexes for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="property-schemaNames"></span>[`$schemaNames`](/docs/api/yii/db/schema/index.md#property-schemaNames) read-only | `string[]` | All schema names in the database, except system schemas. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-schemaPrimaryKeys"></span>[`$schemaPrimaryKeys`](/docs/api/yii/db/constraintfindertrait/index.md#property-schemaPrimaryKeys) read-only | [`yii\db\Constraint`](/docs/api/yii/db/constraint/index.md)`[]` | Primary keys for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="property-schemaUniques"></span>[`$schemaUniques`](/docs/api/yii/db/constraintfindertrait/index.md#property-schemaUniques) read-only | [`yii\db\IndexConstraint`](/docs/api/yii/db/indexconstraint/index.md)`[][]` | Unique constraints for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="property-serverVersion"></span>[`$serverVersion`](/docs/api/yii/db/schema/index.md#property-serverVersion) read-only | `string` | Server version as a string. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-systemSchemaNames"></span>[`$systemSchemaNames`](/docs/api/yii/db/schema/index.md#property-systemSchemaNames) | `list<string>` | List of schema names that should be excluded from [`getSchemaNames()`](/docs/api/yii/db/schema/index.md#method-getSchemaNames). Default: `[]`. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-tableNames"></span>[`$tableNames`](/docs/api/yii/db/schema/index.md#property-tableNames) read-only | `string[]` | All table names in the database. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="property-tableSchemas"></span>[`$tableSchemas`](/docs/api/yii/db/schema/index.md#property-tableSchemas) read-only | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md)`[]` | The metadata for all tables in the database. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`$transactionIsolationLevel`](#property-transactionIsolationLevel) write-only | `string` | The transaction isolation level to use for this transaction. | `Schema` |
| <span id="property-typeMap"></span>`$typeMap` | `array` | Mapping from physical column types (keys) to abstract column types (values) Default: `['tinyint' => self::TYPE_TINYINT, 'bit' => self::TYPE_SMALLINT, 'boolean' => self::TYPE_BOOLEAN, 'bool' => self::TYPE_BOOLEAN, 'smallint' => self::TYPE_SMALLINT, 'mediumint' => self::TYPE_INTEGER, 'int' => self::TYPE_INTEGER, 'integer' => self::TYPE_INTEGER, 'bigint' => self::TYPE_BIGINT, 'float' => self::TYPE_FLOAT, 'double' => self::TYPE_DOUBLE, 'real' => self::TYPE_FLOAT, 'decimal' => self::TYPE_DECIMAL, 'numeric' => self::TYPE_DECIMAL, 'tinytext' => self::TYPE_TEXT, 'mediumtext' => self::TYPE_TEXT, 'longtext' => self::TYPE_TEXT, 'text' => self::TYPE_TEXT, 'varchar' => self::TYPE_STRING, 'string' => self::TYPE_STRING, 'char' => self::TYPE_CHAR, 'blob' => self::TYPE_BINARY, 'datetime' => self::TYPE_DATETIME, 'year' => self::TYPE_DATE, 'date' => self::TYPE_DATE, 'time' => self::TYPE_TIME, 'timestamp' => self::TYPE_TIMESTAMP, 'enum' => self::TYPE_STRING]`. | `Schema` |
| [`$columnQuoteCharacter`](#property-columnQuoteCharacter) protected | `string\|string[]` | Default: `` '`' ``. Available since 2.0.14. | `Schema` |
| [`$tableQuoteCharacter`](#property-tableQuoteCharacter) protected | `string\|string[]` | Default: `` '`' ``. Available since 2.0.14. | `Schema` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-__construct"></span>[`__construct()`](/docs/api/yii/base/baseobject/index.md#method-__construct) | Constructor. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__call"></span>[`__call()`](/docs/api/yii/base/baseobject/index.md#method-__call) | Calls the named method which is not a class method. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__get"></span>[`__get()`](/docs/api/yii/base/baseobject/index.md#method-__get) | Returns the value of an object property. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__isset"></span>[`__isset()`](/docs/api/yii/base/baseobject/index.md#method-__isset) | Checks if a property is set, i.e. defined and not null. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__set"></span>[`__set()`](/docs/api/yii/base/baseobject/index.md#method-__set) | Sets value of an object property. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__unset"></span>[`__unset()`](/docs/api/yii/base/baseobject/index.md#method-__unset) | Sets an object property to null. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-canGetProperty"></span>[`canGetProperty()`](/docs/api/yii/base/baseobject/index.md#method-canGetProperty) | Returns a value indicating whether a property can be read. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-canSetProperty"></span>[`canSetProperty()`](/docs/api/yii/base/baseobject/index.md#method-canSetProperty) | Returns a value indicating whether a property can be set. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-className"></span>[`className()`](/docs/api/yii/base/baseobject/index.md#method-className) static | Returns the fully qualified name of this class. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-convertException"></span>[`convertException()`](/docs/api/yii/db/schema/index.md#method-convertException) | Converts a DB exception to a more concrete one if possible. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`createColumnSchemaBuilder()`](#method-createColumnSchemaBuilder) | Create a column schema builder instance giving the type and value precision. | `Schema` |
| [`createQueryBuilder()`](#method-createQueryBuilder) | Creates a query builder for the MySQL database. | `Schema` |
| <span id="method-createSavepoint"></span>[`createSavepoint()`](/docs/api/yii/db/schema/index.md#method-createSavepoint) | Creates a new savepoint. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`findUniqueIndexes()`](#method-findUniqueIndexes) | Returns all unique indexes for the given table. | `Schema` |
| <span id="method-getLastInsertID"></span>[`getLastInsertID()`](/docs/api/yii/db/schema/index.md#method-getLastInsertID) | Returns the ID of the last inserted row or sequence value. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getPdoType"></span>[`getPdoType()`](/docs/api/yii/db/schema/index.md#method-getPdoType) | Determines the PDO type for the given PHP data value. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getQueryBuilder"></span>[`getQueryBuilder()`](/docs/api/yii/db/schema/index.md#method-getQueryBuilder) |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getRawTableName"></span>[`getRawTableName()`](/docs/api/yii/db/schema/index.md#method-getRawTableName) | Returns the actual name of a given table name. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getSchemaChecks"></span>[`getSchemaChecks()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getSchemaChecks) | Returns check constraints for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getSchemaDefaultValues"></span>[`getSchemaDefaultValues()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getSchemaDefaultValues) | Returns default value constraints for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getSchemaForeignKeys"></span>[`getSchemaForeignKeys()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getSchemaForeignKeys) | Returns foreign keys for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getSchemaIndexes"></span>[`getSchemaIndexes()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getSchemaIndexes) | Returns indexes for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getSchemaNames"></span>[`getSchemaNames()`](/docs/api/yii/db/schema/index.md#method-getSchemaNames) | Returns all schema names in the database, except system schemas. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getSchemaPrimaryKeys"></span>[`getSchemaPrimaryKeys()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getSchemaPrimaryKeys) | Returns primary keys for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getSchemaUniques"></span>[`getSchemaUniques()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getSchemaUniques) | Returns unique constraints for all tables in the database. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getServerVersion"></span>[`getServerVersion()`](/docs/api/yii/db/schema/index.md#method-getServerVersion) | Returns a server version as a string comparable by [`version_compare()`](https://www.php.net/manual/en/function.version-compare.php). | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getTableChecks"></span>[`getTableChecks()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getTableChecks) | Obtains the check constraints information for the named table. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getTableDefaultValues"></span>[`getTableDefaultValues()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getTableDefaultValues) | Obtains the default value constraints information for the named table. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getTableForeignKeys"></span>[`getTableForeignKeys()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getTableForeignKeys) | Obtains the foreign keys information for the named table. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getTableIndexes"></span>[`getTableIndexes()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getTableIndexes) | Obtains the indexes information for the named table. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getTableNames"></span>[`getTableNames()`](/docs/api/yii/db/schema/index.md#method-getTableNames) | Returns all table names in the database. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getTablePrimaryKey"></span>[`getTablePrimaryKey()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getTablePrimaryKey) | Obtains the primary key for the named table. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-getTableSchema"></span>[`getTableSchema()`](/docs/api/yii/db/schema/index.md#method-getTableSchema) | Obtains the metadata for the named table. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getTableSchemas"></span>[`getTableSchemas()`](/docs/api/yii/db/schema/index.md#method-getTableSchemas) | Returns the metadata for all tables in the database. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getTableUniques"></span>[`getTableUniques()`](/docs/api/yii/db/constraintfindertrait/index.md#method-getTableUniques) | Obtains the unique constraints information for the named table. | [`yii\db\ConstraintFinderTrait`](/docs/api/yii/db/constraintfindertrait/index.md) |
| <span id="method-hasMethod"></span>[`hasMethod()`](/docs/api/yii/base/baseobject/index.md#method-hasMethod) | Returns a value indicating whether a method is defined. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-hasProperty"></span>[`hasProperty()`](/docs/api/yii/base/baseobject/index.md#method-hasProperty) | Returns a value indicating whether a property is defined. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-init"></span>[`init()`](/docs/api/yii/base/baseobject/index.md#method-init) | Initializes the object. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-insert"></span>[`insert()`](/docs/api/yii/db/schema/index.md#method-insert) | Executes the INSERT command, returning primary key values. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-isReadQuery"></span>[`isReadQuery()`](/docs/api/yii/db/schema/index.md#method-isReadQuery) | Returns a value indicating whether a SQL statement is for read purpose. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-quoteColumnName"></span>[`quoteColumnName()`](/docs/api/yii/db/schema/index.md#method-quoteColumnName) | Quotes a column name for use in a query. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-quoteSimpleColumnName"></span>[`quoteSimpleColumnName()`](/docs/api/yii/db/schema/index.md#method-quoteSimpleColumnName) | Quotes a simple column name for use in a query. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-quoteSimpleTableName"></span>[`quoteSimpleTableName()`](/docs/api/yii/db/schema/index.md#method-quoteSimpleTableName) | Quotes a simple table name for use in a query. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-quoteTableName"></span>[`quoteTableName()`](/docs/api/yii/db/schema/index.md#method-quoteTableName) | Quotes a table name for use in a query. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`quoteValue()`](#method-quoteValue) | Quotes a string value for use in a query. | `Schema` |
| <span id="method-refresh"></span>[`refresh()`](/docs/api/yii/db/schema/index.md#method-refresh) | Refreshes the schema. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-refreshTableSchema"></span>[`refreshTableSchema()`](/docs/api/yii/db/schema/index.md#method-refreshTableSchema) | Refreshes the particular table schema. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-releaseSavepoint"></span>[`releaseSavepoint()`](/docs/api/yii/db/schema/index.md#method-releaseSavepoint) | Releases an existing savepoint. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-resolveRawTableName"></span>[`resolveRawTableName()`](/docs/api/yii/db/schema/index.md#method-resolveRawTableName) | Resolves the table name and schema name (if any) without loading database metadata. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-rollBackSavepoint"></span>[`rollBackSavepoint()`](/docs/api/yii/db/schema/index.md#method-rollBackSavepoint) | Rolls back to a previously created savepoint. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`setTransactionIsolationLevel()`](#method-setTransactionIsolationLevel) | Sets the isolation level of the current transaction. | `Schema` |
| <span id="method-supportsSavepoint"></span>[`supportsSavepoint()`](/docs/api/yii/db/schema/index.md#method-supportsSavepoint) |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-unquoteSimpleColumnName"></span>[`unquoteSimpleColumnName()`](/docs/api/yii/db/schema/index.md#method-unquoteSimpleColumnName) | Unquotes a simple column name. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-unquoteSimpleTableName"></span>[`unquoteSimpleTableName()`](/docs/api/yii/db/schema/index.md#method-unquoteSimpleTableName) | Unquotes a simple table name. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-createColumnSchema"></span>[`createColumnSchema()`](/docs/api/yii/db/schema/index.md#method-createColumnSchema) protected | Creates a column schema for the database. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`findColumns()`](#method-findColumns) protected | Collects the table column metadata. | `Schema` |
| [`findConstraints()`](#method-findConstraints) protected | Collects the foreign key column details for the given table. | `Schema` |
| <span id="method-findSchemaNames"></span>[`findSchemaNames()`](/docs/api/yii/db/schema/index.md#method-findSchemaNames) protected | Returns all schema names in the database, including the default one but not system schemas. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`findTableNames()`](#method-findTableNames) protected | Returns all table names in the database. | `Schema` |
| <span id="method-getCacheKey"></span>[`getCacheKey()`](/docs/api/yii/db/schema/index.md#method-getCacheKey) protected | Returns the cache key for the specified table name. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getCacheTag"></span>[`getCacheTag()`](/docs/api/yii/db/schema/index.md#method-getCacheTag) protected | Returns the cache tag name. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getColumnPhpType"></span>[`getColumnPhpType()`](/docs/api/yii/db/schema/index.md#method-getColumnPhpType) protected | Extracts the PHP type from abstract DB type. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getSchemaMetadata"></span>[`getSchemaMetadata()`](/docs/api/yii/db/schema/index.md#method-getSchemaMetadata) protected | Returns the metadata of the given type for all tables in the given schema. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getTableMetadata"></span>[`getTableMetadata()`](/docs/api/yii/db/schema/index.md#method-getTableMetadata) protected | Returns the metadata of the given type for the given table. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-getTableNameParts"></span>[`getTableNameParts()`](/docs/api/yii/db/schema/index.md#method-getTableNameParts) protected | Splits full table name into parts. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| [`loadColumnSchema()`](#method-loadColumnSchema) protected | Loads the column information into a [`ColumnSchema`](/docs/api/yii/db/sqlite/columnschema/index.md) object. | `Schema` |
| [`loadTableChecks()`](#method-loadTableChecks) protected |  | `Schema` |
| [`loadTableDefaultValues()`](#method-loadTableDefaultValues) protected |  | `Schema` |
| [`loadTableForeignKeys()`](#method-loadTableForeignKeys) protected |  | `Schema` |
| [`loadTableIndexes()`](#method-loadTableIndexes) protected |  | `Schema` |
| [`loadTablePrimaryKey()`](#method-loadTablePrimaryKey) protected |  | `Schema` |
| [`loadTableSchema()`](#method-loadTableSchema) protected | Loads the metadata for the specified table. | `Schema` |
| [`loadTableUniques()`](#method-loadTableUniques) protected |  | `Schema` |
| <span id="method-normalizePdoRowKeyCase"></span>[`normalizePdoRowKeyCase()`](/docs/api/yii/db/schema/index.md#method-normalizePdoRowKeyCase) protected | Changes row's array key case to lower if PDO's one is set to uppercase. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-resolveTableName"></span>[`resolveTableName()`](/docs/api/yii/db/schema/index.md#method-resolveTableName) protected | Resolves the table name and schema name (if any). | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="method-setTableMetadata"></span>[`setTableMetadata()`](/docs/api/yii/db/schema/index.md#method-setTableMetadata) protected | Sets the metadata of the given type for the given table. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-TYPE_PK"></span>[`TYPE_PK`](/docs/api/yii/db/schema/index.md#const-TYPE_PK) | `'pk'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_UPK"></span>[`TYPE_UPK`](/docs/api/yii/db/schema/index.md#const-TYPE_UPK) | `'upk'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_BIGPK"></span>[`TYPE_BIGPK`](/docs/api/yii/db/schema/index.md#const-TYPE_BIGPK) | `'bigpk'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_UBIGPK"></span>[`TYPE_UBIGPK`](/docs/api/yii/db/schema/index.md#const-TYPE_UBIGPK) | `'ubigpk'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_CHAR"></span>[`TYPE_CHAR`](/docs/api/yii/db/schema/index.md#const-TYPE_CHAR) | `'char'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_STRING"></span>[`TYPE_STRING`](/docs/api/yii/db/schema/index.md#const-TYPE_STRING) | `'string'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_TEXT"></span>[`TYPE_TEXT`](/docs/api/yii/db/schema/index.md#const-TYPE_TEXT) | `'text'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_TINYINT"></span>[`TYPE_TINYINT`](/docs/api/yii/db/schema/index.md#const-TYPE_TINYINT) | `'tinyint'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_SMALLINT"></span>[`TYPE_SMALLINT`](/docs/api/yii/db/schema/index.md#const-TYPE_SMALLINT) | `'smallint'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_INTEGER"></span>[`TYPE_INTEGER`](/docs/api/yii/db/schema/index.md#const-TYPE_INTEGER) | `'integer'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_BIGINT"></span>[`TYPE_BIGINT`](/docs/api/yii/db/schema/index.md#const-TYPE_BIGINT) | `'bigint'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_FLOAT"></span>[`TYPE_FLOAT`](/docs/api/yii/db/schema/index.md#const-TYPE_FLOAT) | `'float'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_DOUBLE"></span>[`TYPE_DOUBLE`](/docs/api/yii/db/schema/index.md#const-TYPE_DOUBLE) | `'double'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_DECIMAL"></span>[`TYPE_DECIMAL`](/docs/api/yii/db/schema/index.md#const-TYPE_DECIMAL) | `'decimal'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_DATETIME"></span>[`TYPE_DATETIME`](/docs/api/yii/db/schema/index.md#const-TYPE_DATETIME) | `'datetime'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_TIMESTAMP"></span>[`TYPE_TIMESTAMP`](/docs/api/yii/db/schema/index.md#const-TYPE_TIMESTAMP) | `'timestamp'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_TIME"></span>[`TYPE_TIME`](/docs/api/yii/db/schema/index.md#const-TYPE_TIME) | `'time'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_DATE"></span>[`TYPE_DATE`](/docs/api/yii/db/schema/index.md#const-TYPE_DATE) | `'date'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_BINARY"></span>[`TYPE_BINARY`](/docs/api/yii/db/schema/index.md#const-TYPE_BINARY) | `'binary'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_BOOLEAN"></span>[`TYPE_BOOLEAN`](/docs/api/yii/db/schema/index.md#const-TYPE_BOOLEAN) | `'boolean'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_MONEY"></span>[`TYPE_MONEY`](/docs/api/yii/db/schema/index.md#const-TYPE_MONEY) | `'money'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-TYPE_JSON"></span>[`TYPE_JSON`](/docs/api/yii/db/schema/index.md#const-TYPE_JSON) | `'json'` |  | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |
| <span id="const-SCHEMA_CACHE_VERSION"></span>[`SCHEMA_CACHE_VERSION`](/docs/api/yii/db/schema/index.md#const-SCHEMA_CACHE_VERSION) | `1` | Schema cache version, to detect incompatibilities in cached values when the data format of the cache changes. | [`yii\db\Schema`](/docs/api/yii/db/schema/index.md) |

## Property details

### $transactionIsolationLevel <span id="property-transactionIsolationLevel"></span>

```php
public string $transactionIsolationLevel
```

The transaction isolation level to use for this transaction.

This can be either [`Transaction::READ_UNCOMMITTED`](/docs/api/yii/db/transaction/index.md#const-READ_UNCOMMITTED) or [`Transaction::SERIALIZABLE`](/docs/api/yii/db/transaction/index.md#const-SERIALIZABLE).

**Access**

Write-only (virtual property).

### $columnQuoteCharacter <span id="property-columnQuoteCharacter"></span>

```php
protected string|string[] $columnQuoteCharacter = '`'
```

An array of 2 characters can be used in case starting and ending characters are different.

**Since**

2.0.14

### $tableQuoteCharacter <span id="property-tableQuoteCharacter"></span>

```php
protected string|string[] $tableQuoteCharacter = '`'
```

An array of 2 characters can be used in case starting and ending characters are different.

**Since**

2.0.14

## Method details

### createColumnSchemaBuilder() <span id="method-createColumnSchemaBuilder"></span>

```php
public function createColumnSchemaBuilder(mixed $type, mixed $length = null): yii\db\sqlite\ColumnSchemaBuilder
```

Create a column schema builder instance giving the type and value precision.

This method may be overridden by child classes to create a DBMS-specific column schema builder.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$type` | `mixed` | Type of the column. See [`ColumnSchemaBuilder::$type`](/docs/api/yii/db/columnschemabuilder/index.md#property-type). |
| `$length` | `mixed` | Length or precision of the column. See [`ColumnSchemaBuilder::$length`](/docs/api/yii/db/columnschemabuilder/index.md#property-length). |

**Returns**

[`ColumnSchemaBuilder`](/docs/api/yii/db/sqlite/columnschemabuilder/index.md): Column schema builder instance

**Since**

2.0.6

### createQueryBuilder() <span id="method-createQueryBuilder"></span>

```php
public function createQueryBuilder(): yii\db\sqlite\QueryBuilder
```

Creates a query builder for the MySQL database.

This method may be overridden by child classes to create a DBMS-specific query builder.

**Returns**

[`QueryBuilder`](/docs/api/yii/db/sqlite/querybuilder/index.md): Query builder instance

### findUniqueIndexes() <span id="method-findUniqueIndexes"></span>

```php
public function findUniqueIndexes(yii\db\TableSchema $table): array
```

Returns all unique indexes for the given table.

Each array element is of the following structure:

```
[
    'IndexName1' => ['col1' [, ...]],
    'IndexName2' => ['col2' [, ...]],
]
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$table` | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) | The table metadata |

**Returns**

`array`: All unique indexes for the given table.

### quoteValue() <span id="method-quoteValue"></span>

```php
public function quoteValue(mixed $value): mixed
```

Quotes a string value for use in a query.

Note that if the parameter is not a string, it will be returned without change.

Since PHP 8.5, `PDO::quote()` throws a ValueError when the string contains null bytes ("\0").

This method sanitizes such bytes before calling the parent implementation to avoid exceptions while maintaining
backward compatibility.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `mixed` |  |

**Returns**

`mixed`: The properly quoted string, or the original data if it is not a string.

### setTransactionIsolationLevel() <span id="method-setTransactionIsolationLevel"></span>

```php
public function setTransactionIsolationLevel(string $level): mixed
```

Sets the isolation level of the current transaction.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$level` | `string` | The transaction isolation level to use for this transaction. This can be either [`Transaction::READ_UNCOMMITTED`](/docs/api/yii/db/transaction/index.md#const-READ_UNCOMMITTED) or [`Transaction::SERIALIZABLE`](/docs/api/yii/db/transaction/index.md#const-SERIALIZABLE). |

**Returns**

`mixed`

**Throws**

- [`yii\base\NotSupportedException`](/docs/api/yii/base/notsupportedexception/index.md): when unsupported isolation levels are used. SQLite only supports SERIALIZABLE and READ UNCOMMITTED.

**See also**

- <https://www.sqlite.org/pragma.html#pragma_read_uncommitted>

### findColumns() <span id="method-findColumns"></span>

```php
protected function findColumns(yii\db\TableSchema $table): bool
```

Collects the table column metadata.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$table` | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) | The table metadata |

**Returns**

`bool`: Whether the table exists in the database

### findConstraints() <span id="method-findConstraints"></span>

```php
protected function findConstraints(yii\db\TableSchema $table): mixed
```

Collects the foreign key column details for the given table.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$table` | [`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md) | The table metadata |

**Returns**

`mixed`

### findTableNames() <span id="method-findTableNames"></span>

```php
protected function findTableNames(mixed $schema = ''): array
```

Returns all table names in the database.

This method should be overridden by child classes in order to support this feature
because the default implementation simply throws an exception.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$schema` | `mixed` | The schema of the tables. Defaults to empty string, meaning the current or default schema. |

**Returns**

`array`: All table names in the database. The names have NO schema name prefix.

**Throws**

- [`yii\base\NotSupportedException`](/docs/api/yii/base/notsupportedexception/index.md): if this method is not supported by the DBMS.

### loadColumnSchema() <span id="method-loadColumnSchema"></span>

```php
protected function loadColumnSchema(array $info): yii\db\sqlite\T
```

Loads the column information into a [`ColumnSchema`](/docs/api/yii/db/sqlite/columnschema/index.md) object.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$info` | `array` | Column information |

**Returns**

`yii\db\sqlite\T`: The column schema object

### loadTableChecks() <span id="method-loadTableChecks"></span>

```php
protected function loadTableChecks(mixed $tableName)
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tableName` | `mixed` |  |

### loadTableDefaultValues() <span id="method-loadTableDefaultValues"></span>

```php
protected function loadTableDefaultValues(mixed $tableName)
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tableName` | `mixed` |  |

**Throws**

- [`yii\base\NotSupportedException`](/docs/api/yii/base/notsupportedexception/index.md): if this method is called.

### loadTableForeignKeys() <span id="method-loadTableForeignKeys"></span>

```php
protected function loadTableForeignKeys(mixed $tableName)
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tableName` | `mixed` |  |

### loadTableIndexes() <span id="method-loadTableIndexes"></span>

```php
protected function loadTableIndexes(mixed $tableName)
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tableName` | `mixed` |  |

### loadTablePrimaryKey() <span id="method-loadTablePrimaryKey"></span>

```php
protected function loadTablePrimaryKey(mixed $tableName)
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tableName` | `mixed` |  |

### loadTableSchema() <span id="method-loadTableSchema"></span>

```php
protected function loadTableSchema(mixed $name): yii\db\TableSchema|null
```

Loads the metadata for the specified table.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `mixed` | Table name |

**Returns**

[`yii\db\TableSchema`](/docs/api/yii/db/tableschema/index.md)`|null`: DBMS-dependent table metadata, `null` if the table does not exist.

### loadTableUniques() <span id="method-loadTableUniques"></span>

```php
protected function loadTableUniques(mixed $tableName)
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tableName` | `mixed` |  |