Add rule to check for explicit db_table #112
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new optional rule to check for
db_table
to be explicitly declared on a model's Meta. One reason you might want to do this is that it makes moving models in bigger projects easier. Adb_table
that isn't explicitly declared will automatically include information about the django app it belongs to. In many cases this is probably desirable, such as when a third party app installs a model into your code base, you want the table names to be namespaced to the app installed. But when dealing with big Django code bases, you might want to rearrange your own models over time, to deprecate old apps or otherwise. So defining explicit db_table should ensure that, regardless of the app you're in, your model maps to the expected db_table name.I can't update the README to include a working wiki link unless it's merged, so I just left that as a
#
for now.