Add new utilities for working with databases and models.

Review Request #10562 — Created May 22, 2019 and submitted

Information

Django Evolution
master

Reviewers

sql_create(), a utility function for generating the SQL for creating
an app's models, has been renamed to sql_create_app(), and its
model-creating functionality split out into sql_create_models(). This
allows callers to generate suitable SQL for creating only a subset of
models for an app, or several models for several apps.

db_router_allows_schema_upgrade() is a new wrapper around
db_router_allows_migrate() and db_router_allows_syncdb(),
simplifying the work required by a caller.

db_get_installable_models_for_app() returns all models that can be
installed in the database (using sql_create_models() or another
operation). It takes care of returning models suitable for the preferred
creation mechanism used on the running version of Django, and handles
checking the router using the new db_router_allows_schema_upgrade().

Unit tests pass on Django 1.6 and 1.11.

Summary ID
Add new utlities for working with databases and models.
`sql_create()`, a utility function for generating the SQL for creating an app's models, has been renamed to `sql_create_app()`, and its model-creating functionality split out into `sql_create_models()`. This allows callers to generate suitable SQL for creating only a subset of models for an app, or several models for several apps. `db_router_allows_schema_upgrade()` is a new wrapper around `db_router_allows_migrate()` and `db_router_allows_syncdb()`, simplifying the work required by a caller. `db_get_installable_models_for_app()` returns all models that can be installed in the database (using `sql_create_models()` or another operation). It takes care of returning models suitable for the preferred creation mechanism used on the running version of Django, and handles checking the router using the new `db_router_allows_schema_upgrade()`.
86ebd48ee6e7743347789f12af242093ea3a09d3
Description From Last Updated

Typo in summary: utlities

daviddavid
david
  1. 
      
  2. Typo in summary: utlities

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (8846769)
Loading...