Updated

db/migrate / 20160214133749_cleanup_country_columns.rb

A
26 lines of codes
2 methods
5.0 complexity/method
1 churn
9.98 complexity
0 duplications
class CleanupCountryColumns < ActiveRecord::Migration
  1. CleanupCountryColumns has no descriptive comment
def up # This migration commands have guard clauses because the preview # website executed a migration that was subsequently deleted # because of performance problems with it. Therefore to ensure # that the runs successfully on preview it needs these clauses. if index_exists?(:country_petition_journals, [:petition_id, :country]) remove_index :country_petition_journals, [:petition_id, :country] end if column_exists?(:country_petition_journals, :country) remove_column :country_petition_journals, :country end if column_exists?(:signatures, :country) remove_column :signatures, :country end end def down add_column :signatures, :country, :string add_column :country_petition_journals, :country, :string add_index :country_petition_journals, [:petition_id, :country], unique: true end end