Since seeds.rb
is in Ruby, I'm guessing that if I want the effect of
insert into foo values (hoo: "ioo", koo: null);
I should do something like
Foo.create(hoo: "ioo", koo: nil)
Does the Ruby value nil
map to the SQL value null
in this case? I'm aware that
Foo.create(hoo: "ioo")
will create a row with koo
of NULL
, but the lines of my seeds.rb
in this case are strings concatenated together in a quick-n-dirty SQL query, so simply skipping columns with null values might require even more mental effort than getting the node module better-sqlite3
to stop spitting out version mismatch messages. I suppose I could rake these seeds and test out my nil
->NULL
hypothesis instead of asking here, but I'm new enough to rails that I'm paranoid about breaking things.
Aucun commentaire:
Enregistrer un commentaire