[1.7.x] Factored create_fk_sql, create_unique_sql, and delete_constraint_sql.

Backport of 0bea6c8749 from master
[1.7.x] Fixed #23065 -- Quoted constraint names in SQL generated by migrations.

Backport of 83cd18633f from master
[1.7.x] Fixed #23503 -- Fixed renaming of model with self-referential m2m field.

Backport of 463952d940 from master
[1.7.x] Skipped a broken geoapp test on Oracle; refs #23504.

Backport of 729cd6a11a from master