diff --git a/db/migrate/20110202141024_set_start_date_of_reference_article.rb b/db/migrate/20110202141024_set_start_date_of_reference_article.rb index cea45dc..eb82330 100644 --- a/db/migrate/20110202141024_set_start_date_of_reference_article.rb +++ b/db/migrate/20110202141024_set_start_date_of_reference_article.rb @@ -1,6 +1,6 @@ class SetStartDateOfReferenceArticle < ActiveRecord::Migration def self.up - execute("SELECT articles.id as a_id, articles.start_date as a_start_date, reference.id as r_id, reference.start_date as r_start_date FROM articles INNER JOIN articles reference ON articles.reference_article_id = reference.id WHERE articles.Type = 'Event' AND articles.start_date IS NULL").each do |data| + execute("SELECT articles.id as a_id, reference.start_date as r_start_date FROM articles INNER JOIN articles reference ON articles.reference_article_id = reference.id WHERE articles.Type = 'Event' AND articles.start_date IS NULL").each do |data| execute("UPDATE articles SET start_date = '#{data['r_start_date']}' WHERE id = #{data['a_id']}") end end diff --git a/db/schema.rb b/db/schema.rb index 3cb1c6c..e28c978 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110127174236) do +ActiveRecord::Schema.define(:version => 20110202141024) do create_table "action_tracker", :force => true do |t| t.integer "user_id" -- libgit2 0.21.2