[1.7.x] Revert "Making SQL management commands migration aware."

This reverts commit cb9c9a7b5879671053c7d2ad6e79943a8814b274.

Backport of 83e7555ffee305c1ea1e0655fd1f0aa35269533f from master.
[1.7.x] Fixed #21938 -- Moved documentation for error views to reference guide.

Backport of 5b98ba08e2cc8760525fc1e0a2c917c063b0d5e2 from master
[1.7.x] Fixed syntax error in ogrinspect.py management command.

Backport of f384b638e2 from master
[1.7.x] Fixed #22659 -- Prevent model states from sharing field instances.

Thanks to Trac alias tbartelmess for the report and the test project.

Backport of 7a38f88922 from master
[1.7.x] Fixed #22711 -- Adjusted ordering checks to allow implicit relation fields.

refs #19195.

Backport of d04e730224 from master
[1.7.x] Fixed #22744 -- Fixed sqlite3 get_relations introspection with views

Thanks Tim Graham for the report and Simon Charette for the review.
Backport of 5a504a5311 from master.