I have an hstore
column in my users
table and seem to be unable to set the default key value pairs via migration or psql.
I have referred to this question Adding a key to an empty hstore column, but with no success.
And as far as a migration solution referred to this article, http://www.economyofeffort.com/2014/12/16/postgres-hstore-default-value-in-rails-4/
But was unable to get by the nil
issue.
How can I create a migration that adds key, value pair defaults to an hstore
column in a table? example... value1 = '1', value2 = '2'
?
Also, how might I do this via psql
?
Apparently few people have had this problem, I figured out the psql
solution after a lot of trial and error and it was insanely simple.
UPDATE users SET settings = '"value1"=>"1", "value2"=>"2"';
Still interested in migration solution however.