On Mon, Jan 9, 2023 at 9:57 AM Thiebo <[email protected]> wrote:

> Hello !
>
> I have this migration :
>
> create_table(:deleted_categories) do
> primary_key :id, :type=>:Bignum
> String :intitule, size: 250, null: false
> String :sens, size: 10, null: false, default: 'depense'
> DateTime :created_at, :null=>false, :default=>Sequel::CURRENT_TIMESTAMP
>

  foreign_key [:id, :intitule], :categories, key: [:id, :intitule]

Thanks,
Jeremy

end
>
> To this, I would like to add a foreign key constraint:
>
> FOREIGN KEY (id, intitule) REFERENCES categories (id, intitule)
>
> Reading through the documentation on migrations, there's a add_constraint
> method, but I don't see how to integrate this in migration upon create
> table.
>
> Thanks !
>
> --
> 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/898fd1dc-cbd8-449e-b95e-853a52f9999bn%40googlegroups.com
> <https://groups.google.com/d/msgid/sequel-talk/898fd1dc-cbd8-449e-b95e-853a52f9999bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADGZSSdBau2TTQnJ%3DhoReLYqo-9_u3NsAR08jG5oc4L1-aksFA%40mail.gmail.com.

Reply via email to