Commit 3f21bb2012de56cbb0bda984dd305f1949cb6513

Authored by Daniela Feitosa
1 parent 8a99ab3a

Added new db/schema and removed unused alias from migration

(ActionItem1809)
db/migrate/20110202141024_set_start_date_of_reference_article.rb
1 class SetStartDateOfReferenceArticle < ActiveRecord::Migration 1 class SetStartDateOfReferenceArticle < ActiveRecord::Migration
2 def self.up 2 def self.up
3 - 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| 3 + 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|
4 execute("UPDATE articles SET start_date = '#{data['r_start_date']}' WHERE id = #{data['a_id']}") 4 execute("UPDATE articles SET start_date = '#{data['r_start_date']}' WHERE id = #{data['a_id']}")
5 end 5 end
6 end 6 end
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 # 9 #
10 # It's strongly recommended to check this file into your version control system. 10 # It's strongly recommended to check this file into your version control system.
11 11
12 -ActiveRecord::Schema.define(:version => 20110127174236) do 12 +ActiveRecord::Schema.define(:version => 20110202141024) do
13 13
14 create_table "action_tracker", :force => true do |t| 14 create_table "action_tracker", :force => true do |t|
15 t.integer "user_id" 15 t.integer "user_id"