This :
add_constraint({name: :tip_not_null, valid: false}, Sequel.~(tip: nil))
Generates this :
ALTER TABLE "orders" ADD CONSTRAINT "tip_not_null" CHECK ('CHECK (`tip` IS
NOT NULL) NOT VALID')
which it weirdly adds some extra check in there
and in a subsequent migration I can take care of the last part with
validate_constraint(:tip_not_null)
Any Way I can get rid of that extra CHECK ?
On Wednesday, October 28, 2020 at 4:05:24 PM UTC-3 Rodrigo Dutra wrote:
> We are using PG 11 so we should be able to add a new column with a default
> value to a big table with no problems, however to also add a NOT NULL
> constraint would be another matter
>
> is there a way in sequel to write the following alter table statement ?
>
> ALTER TABLE *table_name *ADD CONSTRAINT *constraint_name* CHECK (*column* IS
> NOT NULL) NOT VALID;
>
> and then
>
> ALTER TABLE *table_name* VALIDATE CONSTRAINT* constraint_name*;
>
> that way we don't validate the constraint on creation hence not acquiring
> an exclusive lock on the table ?
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/d7bae2f6-32cf-40ea-b608-727d43f50785n%40googlegroups.com.