On Thursday, June 7, 2012 4:16:12 PM UTC-4, Alex Ogier wrote:
>
> This isn't particularly robust. The SQL string generated by a 
> particular backend isn't considered part of any API, and might change 
> formatting or semantics on minor updates. Some SQL is quite 
> complicated and dubiously related to the particular field, such as 
> extra INDEX or UNIQUE constraint statements. Certain backends elide 
> some arguments, performing constraint checking in the application (the 
> sqlite backend for example just drops many constraints). In general, 
> you want the migrations to be DB-agnostic, and checking SQL output 
> loses this feature. 
>
>
While the entire raw SQL generated by a field may be too unstable to 
inspect, the underlying SQL shouldn't be completely ignored. At the very 
least, the datatype needs to be inspected when freezing to detect if the 
rug has been pulled out from under the ORM.

A real world use case. Django-mssql uses the datetime datatype for datetime 
fields. Several years ago, Microsoft made the recommendation that all new 
work should use datetime2. A future version of django-mssql will switch to 
using datetime2. It would be great if the proposed migration framework 
handled that sort of switch, or at the very least displayed a warning about 
the need for manual user intervention.

The same type of problem could be encountered if a database backend becomes 
unsupported and users are forced to switch to another backend where the 
maintainer follows a different set of "best practices". There are many ways 
of storing the same data that are all completely valid. The most likely 
problem field will be IPAddressField due to varchar(15) vs. unsigned int.

Regards,
Michael Manfre

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/OzJ6JJwJxsYJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to