On Fri, May 21, 2021 at 5:25 AM Billy Zheng <[email protected]> wrote:
> > e.g. following code is working. > > Sequel.migration do > change do > add_column :institutions, :stock_name, String > end > end > > Sequel.migration do > change do > rename_column :institutions, :average_cost, :holding_cost > end > end > > but we can not found the add_foreign_key method like this: > > Sequel.migration do > change do > add_foreign_key :insiders, :stock_id, :stocks > end > end > add_foreign_key is not directly defined on Sequel::Database objects, so you have to use it inside alter_table. The only reason that similar schema modification methods are defined directly on Sequel::Database objects is due to backwards compatibility. If backwards compatibility was not a concern, add_column and rename column would also only be callable inside alter_table. 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 view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CADGZSSfEs2wueYbbkXRzormniZA3BwVAHJu6finvx9v97v929g%40mail.gmail.com.
