Sha256: d500d17f2b9403a9aa62c3315902b6fcdbf2f2fe54341d911b3e6490f8a21449
Contents?: true
Size: 723 Bytes
Versions: 8
Compression:
Stored size: 723 Bytes
Contents
Sequel.migration do up do alter_table :comparisons do add_column :lhs_which, Integer add_column :rhs_which, Integer end ds = self[:comparisons]. select(:comparisons__id). join(:matchers, :matchers__id => :comparisons__matcher_id). join(:scenarios, :scenarios__id => :matchers__scenario_id). filter(:scenarios__resource_2_id => nil) ids = ds.all.collect { |x| x[:id] } self[:comparisons].filter(:id => ids, :lhs_type => 'field').update(:lhs_which => 1) self[:comparisons].filter(:id => ids, :rhs_type => 'field').update(:rhs_which => 2) end down do alter_table :comparisons do drop_column :lhs_which drop_column :rhs_which end end end
Version data entries
8 entries across 8 versions & 1 rubygems