Re: Proposal: Database Constraints

2014-04-03 Thread Thejaswi Puthraya
On Wednesday, April 2, 2014 4:09:37 AM UTC+5:30, simonb wrote: > > Hi > > Just FYI: back in 2007 GSOC there was a project to add constraints. The > syntax was as follows: > The code is at https://github.com/theju/django-check-constraints/ I doubt it works as is after the SQL compiler changes. I

Re: Proposal: Database Constraints

2014-04-02 Thread Andrew Godwin
As I've said on other threads, fields can't define extra operations - they must do everything inside the SchemaEditor's add_field method (operations are not the only thing which calls the SchemaEditor, in theory). Ticket #22022 (https://code.djangoproject.com/ticket/22022) covers this - there'll be

Re: Proposal: Database Constraints

2014-04-02 Thread Anssi Kääriäinen
On Wednesday, April 2, 2014 6:58:22 AM UTC+3, schinckel wrote: > For that reason, I wouldn't be the fan of the exploded syntax you've >> given; I think I'd rather just be able to supply a list of strings for my >> constraints that are SQL themselves; there's no real benefit to abstraction >> he

Re: Proposal: Database Constraints

2014-04-01 Thread schinckel
On Wednesday, April 2, 2014 3:35:24 AM UTC+10:30, Andrew Godwin wrote: > > Hmm, I'm not sure about this. On the one hand, during the migrations work > I refactored check constraints for the existing stuff (e.g. > PostitiveIntegerField) out of the type string and into a separate check > constra

Re: Proposal: Database Constraints

2014-04-01 Thread Simon Blanchard
Hi Just FYI: back in 2007 GSOC there was a project to add constraints. The syntax was as follows: class Manufacturer(models.Model): mfg_name = models.CharField(maxlength=50) car_sale_start = models.DateField() car_sale_end = models.DateField() quantity_sold = models.IntegerField() car_price = mod

Re: Proposal: Database Constraints

2014-04-01 Thread Andrew Godwin
Hmm, I'm not sure about this. On the one hand, during the migrations work I refactored check constraints for the existing stuff (e.g. PostitiveIntegerField) out of the type string and into a separate check constraints string, so some of the work is already there, especially around making sure they'

Proposal: Database Constraints

2014-04-01 Thread schinckel
Some years ago, I discussed adding database-level check constraints into django: https://groups.google.com/forum/#!topic/django-developers/OJN5kpcseAg There is also an issue: https://code.djangoproject.com/ticket/11964 I'm thinking about revisiting this, and wanted to get some discussion going