Created
August 4, 2012 14:22
-
-
Save bru/3258069 to your computer and use it in GitHub Desktop.
Sinatra HStore setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems gem "sinatra" | |
gem "pg" gem "activerecord-postgres-hstore" | |
gem "sinatra-activerecord" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Setuphstore < ActiveRecord::Migration | |
def up | |
execute "CREATE EXTENSION hstore" | |
end | |
def down | |
execute "DROP EXTENSION hstore" | |
end | |
end | |
class CreateSettings < ActiveRecord::Migration | |
def up | |
create_table :settings do |t| | |
t.string :name | |
t.hstore :data | |
t.timestamps | |
end | |
end | |
def down | |
drop_table :settings | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/activerecord/rake' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment