inspectdb database defaults

81 views
Skip to first unread message

Collin Anderson

unread,
Mar 10, 2015, 11:56:29 AM3/10/15
to django-d...@googlegroups.com
Hi All,

We recently added database introspection of defaults for purposes of testing migrations.


I would find it useful to have inspectdb attempt to use those defaults when generating models. (My use case is running inspectdb on a WordPress database which has a bunch of database defaults.)


Though Tim says: "Translating database level defaults into model field defaults isn't functionally equivalent and given that Django doesn't translate the model field default option into a database level default, I think it would be inconsistent to do a conversion in the other direction."

Collin

Michael Manfre

unread,
Mar 10, 2015, 1:40:16 PM3/10/15
to django-d...@googlegroups.com
I agree with Tim.

I would support refactoring inspectdb so that it would be easier for anyone to subclass the command and add additional logic to the introspection process. Alternatively, moving much of the logic out to a function that returns a JSON representation of the database that inspectdb uses to write the model data.

Regards,
Michael Manfre

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/11972cea-2565-4940-abe6-8cdec8f40a1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shai Berger

unread,
Mar 10, 2015, 7:43:28 PM3/10/15
to django-d...@googlegroups.com
On Tuesday 10 March 2015 19:39:19 Michael Manfre wrote:
> I agree with Tim.
>
> I would support refactoring inspectdb so that it would be easier for anyone
> to subclass the command and add additional logic to the introspection
> process.

+1.

Shai.
Reply all
Reply to author
Forward
0 new messages