Sha256: 2762631b71b0a6033d92cda195c17746fb364fabcdd3441ed31212f448284ba7

Contents?: true

Size: 925 Bytes

Versions: 70

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

class UseMd5Indexes < ActiveRecord::Migration[5.2]
  def up
    remove_index :decidim_proposals_proposals, name: "decidim_proposals_proposal_title_search"
    remove_index :decidim_proposals_proposals, name: "decidim_proposals_proposal_body_search"
    execute "CREATE INDEX decidim_proposals_proposal_title_search ON decidim_proposals_proposals(md5(title::text))"
    execute "CREATE INDEX decidim_proposals_proposal_body_search ON decidim_proposals_proposals(md5(body::text))"
  end

  def down
    remove_index :decidim_proposals_proposals, name: "decidim_proposals_proposal_title_search"
    remove_index :decidim_proposals_proposals, name: "decidim_proposals_proposal_body_search"
    add_index :decidim_proposals_proposals, :title, name: "decidim_proposals_proposal_title_search"
    add_index :decidim_proposals_proposals, :body, name: "decidim_proposals_proposal_body_search"
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
decidim-proposals-0.20.1 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.20.0 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.19.1 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.18.1 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.19.0 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.17.2 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.18.0 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.17.1 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.16.1 db/migrate/20190215113158_use_md5_indexes.rb
decidim-proposals-0.17.0 db/migrate/20190215113158_use_md5_indexes.rb