Issue: MariaDB/Mysql index type
Author: chewvader
State: closed
Created: 2020-08-11 06:01:54

I believe peewee isn't creating the correct "create index" syntax for mysql index_types. This was tested with mariadb==10.5.4, peewee==3.13.3.

```
import logging
from peewee import *

pwlogger = logging.getLogger('peewee')
pwlogger.addHandler(logging.StreamHandler())
pwlogger.setLevel(logging.DEBUG)

db = MySQLDatabase('<db>', user='<user>', password='<password>',
                         host='<host>', port=3306)


class testmodel(Model):
    timestamp = IntegerField(index=True, index_type='BTREE')

    class Meta:
        database = db

with db:
    db.create_tables([testmodel])
```
Results in:
```
('SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type != %s ORDER BY table_name', ('VIEW',))
('CREATE TABLE IF NOT EXISTS `testmodel` (`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, `timestamp` INTEGER NOT NULL)', [])
('CREATE INDEX `testmodel_timestamp` ON `testmodel` USING BTREE (`timestamp`)', [])
Traceback (most recent call last):
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/peewee.py", line 3099, in execute_sql
    cursor.execute(sql, params or ())
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/cursors.py", line 163, in execute
    result = self._query(query)
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/cursors.py", line 321, in _query
    conn.query(q)
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/connections.py", line 505, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/connections.py", line 724, in _read_query_result
    result.read()
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/connections.py", line 1069, in read
    first_packet = self.connection._read_packet()
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/connections.py", line 676, in _read_packet    packet.raise_for_error()
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/protocol.py", line 223, in raise_for_error    err.raise_mysql_exception(self._data)
  File "/home/<user>/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (`timestamp`)' at line 1")
```

The documentation for "CREATE INDEX" for [mysql ](https://dev.mysql.com/doc/refman/8.0/en/create-index.html) shows 
```
CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name
    [index_type]
    ON tbl_name (key_part,...)
    [index_option]
    [algorithm_option | lock_option]
```
or:
`create index <index name> using <index type> on <table> (<field(s)>)`

While on [postgres](https://www.postgresql.org/docs/current/sql-createindex.html)
```
CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] name ] ON [ ONLY ] table_name [ USING method ]
    ( { column_name | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] )
    [ INCLUDE ( column_name [, ...] ) ]
    [ WITH ( storage_parameter = value [, ... ] ) ]
    [ TABLESPACE tablespace_name ]
    [ WHERE predicate ]
```
or:
`create index <index name> on <table> using <index type> (<field(s)>)`

The executed statement looks like postgres syntax as opposed to mysql.
```CREATE INDEX `testmodel_timestamp` ON `testmodel` USING BTREE (`timestamp`)```
which bombs.

If I manually execute:
```
CREATE INDEX `testmodel_timestamp` USING BTREE ON `testmodel` (`timestamp`);
-- or
CREATE INDEX `testmodel_timestamp` ON `testmodel` (`timestamp`) USING BTREE;
```
it succeeds.


Thank you for the report, I'll see about putting together a fix.