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

Use signal and command to provide the same capability of the custom database backend #2

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

Conversation

adieu
Copy link

@adieu adieu commented Jun 23, 2012

Current custom database backend does 3 things:

  1. Call register_hstore for each connection.
  2. Install hstore contrib for every database created.
  3. Create index for hstore field.

This commit use connection_created to do the first two things. And sqlhstoreindexes command to do the third thing.

Plus this commit also fixed an issue when using south to add an hstore field with a default value.

There are two reasons why I wanted to avoid using custom database backend:

  1. Other django app might monkey patch the database backend from django to provide some features. Use a custom backend might lose those features.
  2. If we have to write a custom backend when we add a new field type, next time when we add another field type we might have to write another backend. But in order to use those two field types simultaneously, we have to write a third backend to include both patches made by the first two. This don't sound very user friendly.

So I think it might be a good idea to provide the feature without using a custom backend.

adieu added 10 commits June 23, 2012 16:38
…atabase backend.

Current custom database backend does 3 things:

 1. Call register_hstore for each connection.
 2. Install hstore contrib for every database created.
 3. Create index for hstore field.

This commit use connection_created to do the first two things. And sqlhstoreindexes command to do the third thing.

Plus this commit also fixed an issue when using south to add an hstore field with a default value.
nemesifier pushed a commit to nemesifier/django-hstore that referenced this pull request Dec 19, 2013
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.

2 participants