Updated

db/migrate / 20150820155740_insert_initial_country_petition_journals.rb

A
17 lines of codes
2 methods
1.6 complexity/method
1 churn
3.2 complexity
0 duplications
class InsertInitialCountryPetitionJournals < ActiveRecord::Migration
  1. InsertInitialCountryPetitionJournals has no descriptive comment
def up execute <<-SQL.strip_heredoc INSERT INTO country_petition_journals (petition_id, country, signature_count, created_at, updated_at) SELECT petition_id, country, COUNT(*) AS signature_count, timezone('utc', now()), timezone('utc', now()) FROM signatures GROUP BY petition_id, country SQL end def down execute "DELETE FROM country_petition_journals" end end