Is there migration support for the json data type?
vjpr opened this issue · comments
i.e. t.json :json_blob
You can now on master. Added in 31f89c7
Fantastic!
On Fri, Jun 21, 2013 at 1:31 AM, Jack Christensen
notifications@github.comwrote:
You can now on master. Added in 31f89c731f89c7
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-19761097
.
Couldn't get it to work
undefined method `json' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x007fdfee0fe080>
Using like this:
class Initial < ActiveRecord::Migration
def change
create_table :users, :id => false do |t|
t.uuid :id, :primary_key => true
t.string :name
t.string :email
t.string :password
t.string :salt
t.json :fb
t.string :fb_id
t.timestamps
end
end
Are you using github as your gem source? It's not in a released gem yet.
i.e. Your Gemfile should have this line in it:
gem 'surus', github: 'JackC/surus'
I just tested it and it works for me:
Migration:
class AddDocToUsers < ActiveRecord::Migration
def change
add_column :users, :doc, :json
end
end
Execution:
jack@hk-47~/dev/surus_test_3_2_13$ rake db:migrate
== AddDocToUsers: migrating ==================================================
-- add_column(:users, :doc, :json)
-> 0.0008s
== AddDocToUsers: migrated (0.0009s) =========================================
Yep I have gem 'surus', :github => 'JackC/surus', :branch => 'master'
Using surus (0.4.1) from git://github.com/JackC/surus.git (at master)
Did you test it with the block version migration?
On Fri, Jun 21, 2013 at 1:57 AM, Jack Christensen
notifications@github.comwrote:
Are you using github as your gem source? It's not in a released gem yet.
i.e. Your Gemfile should have this line in it:
gem 'surus', github: 'JackC/surus'
I just tested it and it works for me:
Migration:
class AddDocToUsers < ActiveRecord::Migration
def change
add_column :users, :doc, :json
end
endExecution:
jack@hk-47~/dev/surus_test_3_2_13$ rake db:migrate
== AddDocToUsers: migrating ==================================================
-- add_column(:users, :doc, :json)
-> 0.0008s
== AddDocToUsers: migrated (0.0009s) =========================================—
Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-19762788
.
Okay just tested.
add_column :users, :doc, :json
works
t.json
doesn't.
And schema.rb
doesn't work
# Could not dump table "users" because of following StandardError
# Unknown type 'json' for column 'fb'
I just pushed an update to master. bundle update surus and try again.