public static function recreate($typeName, $values)
    {
        $db = static::getDb();
        $quotedType = $db->quoteColumnName($typeName);

        $transaction = $db->beginTransaction();
        try {
            $columns = static::columns($typeName);

            do {
                $tmpTypeName = md5(rand());
            } while (static::exists($tmpTypeName));

            static::rename($typeName, $tmpTypeName);
            static::create($typeName, $values);

            $schema = $db->getSchema();
            foreach ($columns as $column) {
                $quotedColumn = $db->quoteColumnName($column['column_name']);
                $db->createCommand(
                    'ALTER TABLE ' . $db->quoteTableName($column['table_name'])
                    . ' ALTER ' . $quotedColumn
                    . ' TYPE ' . $quotedType
                    . ' USING ' . $quotedColumn . '::text::' . $quotedType
                )->execute();
                $schema->refreshTableSchema($column['table_name']);
            }

            static::drop($tmpTypeName);

            $transaction->commit();
        } catch (\Exception $e) {
            $transaction->rollBack();
            throw $e;
        }
    }