Commit 8a99ab3acca7df86e3cb92fdffa7c87d46280333
Committed by
Daniela Feitosa
1 parent
c40cfd39
Exists in
master
and in
22 other branches
Added date for events with nil date
(ActionItem1809)
Showing
2 changed files
with
13 additions
and
2 deletions
Show diff stats
db/migrate/20110202141024_set_start_date_of_reference_article.rb
0 → 100644
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +class SetStartDateOfReferenceArticle < ActiveRecord::Migration | |
| 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| | |
| 4 | + execute("UPDATE articles SET start_date = '#{data['r_start_date']}' WHERE id = #{data['a_id']}") | |
| 5 | + end | |
| 6 | + end | |
| 7 | + | |
| 8 | + def self.down | |
| 9 | + say "Nothing to do" | |
| 10 | + end | |
| 11 | +end | ... | ... |
db/schema.rb
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | # |
| 10 | 10 | # It's strongly recommended to check this file into your version control system. |
| 11 | 11 | |
| 12 | -ActiveRecord::Schema.define(:version => 20101221134544) do | |
| 12 | +ActiveRecord::Schema.define(:version => 20110127174236) do | |
| 13 | 13 | |
| 14 | 14 | create_table "action_tracker", :force => true do |t| |
| 15 | 15 | t.integer "user_id" |
| ... | ... | @@ -31,8 +31,8 @@ ActiveRecord::Schema.define(:version => 20101221134544) do |
| 31 | 31 | t.integer "profile_id" |
| 32 | 32 | end |
| 33 | 33 | |
| 34 | + add_index "action_tracker_notifications", ["action_tracker_id", "profile_id"], :name => "index_action_tracker_notifications_on_profile_id_and_action_tra", :unique => true | |
| 34 | 35 | add_index "action_tracker_notifications", ["action_tracker_id"], :name => "index_action_tracker_notifications_on_action_tracker_id" |
| 35 | - add_index "action_tracker_notifications", ["profile_id", "action_tracker_id"], :name => "index_action_tracker_notifications_on_profile_id_and_action_tracker_id", :unique => true | |
| 36 | 36 | add_index "action_tracker_notifications", ["profile_id"], :name => "index_action_tracker_notifications_on_profile_id" |
| 37 | 37 | |
| 38 | 38 | create_table "article_versions", :force => true do |t| | ... | ... |