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.
Actually this was testing the first index, not the first column.  But in any case, I simplified this away.