Update and document the database test data for indexes.

Review Request #8104 — Created April 6, 2016 and submitted — Latest diff uploaded


Django Evolution


Our sets of comparison SQL statements used for the unit tests had some
statements left with hard-coded index names, which aren't future-proof.

This change fixes those and prepares for the Django 1.7+ work by beefing
up how the test index name generation works. Each file of test SQL
statements now creates a local version of generate_index_name() using
the new make_generate_index_name() function, passing in the database
type. This allows generate_index_name() to be smarter about how it
handles certain types of indexes, particularly those for Postgres
(which, through Django 1.6, used a legacy set of rules for generating
index names).

There's also additional information now indicating if an index will be
used for Django's index_together.

Future changes will build upon this by creating variations of the index
name generation rules for Django 1.7, 1.8, and 1.9.

There's also new documentation in place for the affected functions, to
help with future maintenance.

Unit tests pass for SQLite3, MySQL, and Postgres.