Updated

db/migrate / 20170711134758_add_tags_to_petitions_and_archived_petitions.rb

A
24 lines of codes
2 methods
4.0 complexity/method
1 churn
8.0 complexity
0 duplications
class AddTagsToPetitionsAndArchivedPetitions < ActiveRecord::Migration
  1. AddTagsToPetitionsAndArchivedPetitions has no descriptive comment
def up add_column :petitions, :tags, :integer, array: true, null: false, default: "{}" add_column :archived_petitions, :tags, :integer, array: true, null: false, default: "{}" execute <<-SQL CREATE INDEX index_petitions_on_tags ON petitions USING gin(tags gin__int_ops); SQL execute <<-SQL CREATE INDEX index_archived_petitions_on_tags ON archived_petitions USING gin(tags gin__int_ops); SQL end def down execute "DROP INDEX index_petitions_on_tags;" execute "DROP INDEX index_archived_petitions_on_tags;" remove_column :petitions, :tags remove_column :archived_petitions, :tags end end