Class: InstallHstore
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- InstallHstore
- Defined in:
- lib/generators/surus/hstore/templates/install_hstore.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
18 19 20 21 |
# File 'lib/generators/surus/hstore/templates/install_hstore.rb', line 18 def self.down version = ActiveRecord::Base.connection.send(:postgresql_version) execute "DROP EXTENSION hstore" if version >= 90100 end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/surus/hstore/templates/install_hstore.rb', line 2 def self.up version = ActiveRecord::Base.connection.send(:postgresql_version) # check for newer versions if version >= 90100 sql = "CREATE EXTENSION hstore" # use the hstore.sql file on the system, if found elsif(path = hstore_sql_path) sql = File.read(path) # run a default hstore.sql else sql = default_sql end execute sql end |