post_to_twitter: start logging twitter ids now for an upcoming change

This commit is contained in:
joshua stein 2015-01-27 12:13:47 -06:00
parent 1eb9413f8a
commit 6aba206eba
3 changed files with 12 additions and 2 deletions

View file

@ -0,0 +1,6 @@
class AddStoryTwitterId < ActiveRecord::Migration
def change
add_column :stories, :twitter_id, :string, :limit => 20
add_index :stories, [ :twitter_id ]
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150115172138) do
ActiveRecord::Schema.define(version: 20150127180326) do
create_table "comments", force: true do |t|
t.datetime "created_at", null: false
@ -115,12 +115,14 @@ ActiveRecord::Schema.define(version: 20150115172138) do
t.integer "comments_count", default: 0, null: false
t.integer "merged_story_id"
t.datetime "unavailable_at"
t.string "twitter_id", limit: 20
end
add_index "stories", ["hotness"], name: "hotness_idx", using: :btree
add_index "stories", ["is_expired", "is_moderated"], name: "is_idxes", using: :btree
add_index "stories", ["merged_story_id"], name: "index_stories_on_merged_story_id", using: :btree
add_index "stories", ["short_id"], name: "unique_short_id", unique: true, using: :btree
add_index "stories", ["twitter_id"], name: "index_stories_on_twitter_id", using: :btree
add_index "stories", ["url"], name: "url", length: {"url"=>191}, using: :btree
create_table "tag_filters", force: true do |t|

View file

@ -48,7 +48,9 @@ order(:id).each do |s|
{ "status" => status })
begin
if !res["id_str"].match(/\d+/)
if res["id_str"].match(/\d+/)
s.update_column("twitter_id", res["id_str"])
else
raise
end
rescue => e