BUG: When creating table, db indexes should be created from DataFrame indexes

Unfortunately my PR #8022 introduced a bug wherein database indexes are not created from DataFrame indexes.  This pull request fixes it, also introduces this feature for the legacy interface, and adds tests to make sure indexes are created as appropriate.
the `self.conn` is not needed (actually, I am surprised this does not give a warning), as you are calling `to_sql` as the method of `pandasSQL`. 
So either `pandasSQL.to_sql(df, 'name')`, or `df.to_sql('name', conn)` or `sql.to_sql(df, 'name', conn)`