Foreign key nullify in schema.rb should be set null in generated input

It looks like Rails schema.rb import where foreign keys that were generated with on_delete: nullify in the migration fail to parse.

schema.rb contains a line like this

add_foreign_key "model1", "model2", on_delete: :nullify

the translated input after import contains a line like this

Ref "fk_rails_model1_model2":"model1"."model2_id" - "model2"."id" [delete: nullify]

and raises an error about the [delete: nullify] behavior

Expected cascade, comment, no action, restrict, set default, set null, or whitespace but "n" found.

I expect the output should have been set null, and confirmed this by editing the generated input (once the nullify triggers were removed the schema image was rendered correctly).

1 Like