Sha256: ba8244be353367305eb9705715cb3f18c56a934d02a46d4ec6adebdb8fe5c124

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

Sequel.migration do
  up do
    add_column :in_app_purchase_products, :tsv, 'TSVector'
    add_index :in_app_purchase_products, :tsv, type: "GIN"
    create_trigger :in_app_purchase_products, :tsv, :tsvector_update_trigger, 
      args: [:tsv, :'pg_catalog.english', :product_identifier, :type, :title, :description], 
      events: [:insert, :update], 
      each_row: true

    add_column :in_app_purchase_receipts, :tsv, 'TSVector'
    add_index :in_app_purchase_receipts, :tsv, type: "GIN"
    create_trigger :in_app_purchase_receipts, :tsv, :tsvector_update_trigger, 
      args: [:tsv, :'pg_catalog.english', :product_id, :transaction_id, :app_item_id], 
      events: [:insert, :update], 
      each_row: true
  end

  down do
    drop_column :in_app_purchase_products, :tsv
    drop_index :in_app_purchase_products, :tsv
    drop_trigger :in_app_purchase_products, :tsv

    drop_column :in_app_purchase_receipts, :tsv
    drop_index :in_app_purchase_receipts, :tsv
    drop_trigger :in_app_purchase_receipts, :tsv
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-in-app-purchase-0.1.1 ./lib/rack/in-app-purchase/migrations/002_add_full_text_search.rb
rack-in-app-purchase-0.1.0 ./lib/rack/in-app-purchase/migrations/002_add_full_text_search.rb