Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to check for explicit db_table #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

js-truework
Copy link

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. A db_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant