public function describeTable($table) {
        return $this->cacheQuery([__METHOD__, $table], function(SqliteDriver $driver) use ($table) {
            $columns = $driver->executeQuery('PRAGMA table_info("' . $table  . '");')->find();
            $schema = [];

            if (!$columns) {
                return $schema;
            }

            foreach ($columns as $column) {
                $field = $column['name'];
                $type = strtolower($column['type']);
                $length = '';

                // Determine type and length
                if (preg_match('/([a-z]+)(?:\(([0-9,]+)\))?/is', $type, $matches)) {
                    $type = strtolower($matches[1]);

                    if (isset($matches[2])) {
                        $length = $matches[2];
                    }
                }

                // Inherit type defaults
                $data = $driver->getType($type)->getDefaultOptions();

                // Overwrite with custom
                $data = [
                    'field' => $field,
                    'type' => $type,
                    'length' => $length,
                    'null' => !$column['notnull'],
                    'default' => $column['dflt_value']
                ] + $data;

                if ($column['pk']) {
                    $data['primary'] = true;
                    $data['ai'] = true;
                }

                if ($data['default'] === 'NULL') {
                    $data['default'] = null;
                }

                $schema[$field] = $data;
            }

            return $schema;
        }, '+1 year');
    }
public function describeTable($table) {
        return $this->cacheQuery([__METHOD__, $table], function(SqliteDriver $driver) use ($table) {
            $columns = $driver->executeQuery('PRAGMA table_info("' . $table  . '");')->find();
            $schema = [];

            if (!$columns) {
                return $schema;
            }

            foreach ($columns as $column) {
                $field = $column['name'];
                $type = strtolower($column['type']);
                $length = '';

                // Determine type and length
                if (preg_match('/([a-z]+)(?:\(([0-9,]+)\))?/is', $type, $matches)) {
                    $type = strtolower($matches[1]);

                    if (isset($matches[2])) {
                        $length = $matches[2];
                    }
                }

                // Inherit type defaults
                $data = $driver->getType($type)->getDefaultOptions();

                // Overwrite with custom
                $data = [
                    'field' => $field,
                    'type' => $type,
                    'length' => $length,
                    'null' => !$column['notnull'],
                    'default' => $column['dflt_value']
                ] + $data;

                if ($column['pk']) {
                    $data['primary'] = true;
                    $data['ai'] = true;
                }

                if ($data['default'] === 'NULL') {
                    $data['default'] = null;
                }

                $schema[$field] = $data;
            }

            return $schema;
        }, '+1 year');
    }
{@inheritdoc}

@uses Titon\Db\Type\AbstractType