Reputation: 63
I use rails with postgreSQL, I want to add a new column with a default null value, do I have to specify the default null value?
add_column :posts, :string, default: null
Upvotes: 2
Views: 2825
Reputation: 776
You don't need to specify it. When you add new column to table without default value all the values will be null.
Also: note that in ruby the equivalent of psql Null
value is nil
.
Upvotes: 5