On Saturday, March 2, 2019 at 12:13:16 PM UTC-8, Jeremy Evans wrote:
>
> On Saturday, March 2, 2019 at 9:58:16 AM UTC-8, Mike Pastore wrote:
>>
>> Jeremy,
>>
>> Just to confirm something. It appears that dropping the table :foo does 
>> not also drop all constraint validations for table :foo. So my down 
>> migrations should all look like this:
>>
>> down do
>>   drop_table(:foo)
>>   drop_constraint_validations_for(:table=>:foo)
>> end
>>
>> In order to prevent the sequel_constraint_validations table from becoming 
>> "cluttered." Or am I missing something?
>>
>> This is particular relevant if you later recreate the table with 
>> similar-but-slightly-different constraint validations. I had a case where I 
>> created a constraint validation with :allow_nil=>false, subsequently 
>> dropped the table, then later recreated the table and the same-named 
>> constraint validation but with :allow_nil=>true. This led to a situation 
>> where the former rule was still in effect when I expected the latter. 
>>
>> I could also see a situation where defunct constraint validations persist 
>> in the sequel_constraint_validations table—for a dropped column, say—and 
>> get applied by the model plugin even though they are no longer valid. 
>>
>> It would be nice if dropping a table or a column automatically removed 
>> applicable constraint validations, if that's even possible. Just a wishful 
>> thought.
>>
>
> It is expected that currently you have to drop the constraint validations 
> manually. However, I think it makes sense to drop them automatically, and 
> it should still be backwards compatible (the 
> drop_constraint_validations_for call should be idempotent).  If you would 
> like to work on a PR for the constraint_validations extension, that would 
> probably speed up the process, but I'll try to get to it sometime in the 
> next few releases.
>

Change 
committed: 
https://github.com/jeremyevans/sequel/commit/d198cc1851c7cba380632a35f88ca193c346d6ae

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to