Sha256: d7624d930d1317305d79bbfd81512898d345070eba6a974d071725b51b4c7da1

Contents?: true

Size: 491 Bytes

Versions: 6

Compression:

Stored size: 491 Bytes

Contents

# FIXME: move this with 'node_query' into a plugins might be cleaner
# make sure there exists a link with NULL content and id == -1 (used in queries using query order sorting)
class ChangeDefaultLinkIdToZero < ActiveRecord::Migration
  def self.up
    Link.connection.execute "UPDATE #{Link.table_name} SET id = 0 WHERE id = -1"
    Zena::Use::QueryNode.insert_zero_link(Link)
  end

  def self.down
    Link.connection.execute "UPDATE #{Link.table_name} SET id = -1 WHERE id = 0"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zena-0.16.9 db/migrate/047_change_default_link_id_to_zero.rb
zena-0.16.8 db/migrate/047_change_default_link_id_to_zero.rb
zena-0.16.7 db/migrate/047_change_default_link_id_to_zero.rb
zena-0.16.6 db/migrate/047_change_default_link_id_to_zero.rb
zena-0.16.5 db/migrate/047_change_default_link_id_to_zero.rb
zena-0.16.4 db/migrate/047_change_default_link_id_to_zero.rb