From 012f5b561416f8b6e51c3934ea4503ae27e011e8 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Tue, 2 Aug 2016 23:25:39 +0200 Subject: [PATCH] migration to remove all unused old columns from the posts table --- .../20160802212635_cleanup_posts_table.rb | 26 +++++++++++++++++++ db/schema.rb | 17 +----------- 2 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 db/migrate/20160802212635_cleanup_posts_table.rb diff --git a/db/migrate/20160802212635_cleanup_posts_table.rb b/db/migrate/20160802212635_cleanup_posts_table.rb new file mode 100644 index 000000000..bffff39ac --- /dev/null +++ b/db/migrate/20160802212635_cleanup_posts_table.rb @@ -0,0 +1,26 @@ +class CleanupPostsTable < ActiveRecord::Migration + def change + remove_index :posts, column: %i(status_message_guid pending), + name: :index_posts_on_status_message_guid_and_pending, length: {status_message_guid: 190} + remove_index :posts, column: :status_message_guid, name: :index_posts_on_status_message_guid, length: 191 + + # from photos? + remove_column :posts, :remote_photo_path, :text + remove_column :posts, :remote_photo_name, :string + remove_column :posts, :random_string, :string + remove_column :posts, :processed_image, :string + remove_column :posts, :unprocessed_image, :string + remove_column :posts, :status_message_guid, :string + + # old cubbi.es stuff + remove_column :posts, :object_url, :string + remove_column :posts, :image_url, :string + remove_column :posts, :image_height, :integer + remove_column :posts, :image_width, :integer + remove_column :posts, :actor_url, :string + remove_column :posts, :objectId, :string + + # old single post view templates + remove_column :posts, :frame_name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 5e9267dd9..54eab492b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160720212620) do +ActiveRecord::Schema.define(version: 20160802212635) do create_table "account_deletions", force: :cascade do |t| t.string "diaspora_handle", limit: 255 @@ -453,28 +453,15 @@ ActiveRecord::Schema.define(version: 20160720212620) do t.boolean "pending", default: false, null: false t.string "type", limit: 40, null: false t.text "text", limit: 65535 - t.text "remote_photo_path", limit: 65535 - t.string "remote_photo_name", limit: 255 - t.string "random_string", limit: 255 - t.string "processed_image", limit: 255 t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "unprocessed_image", limit: 255 - t.string "object_url", limit: 255 - t.string "image_url", limit: 255 - t.integer "image_height", limit: 4 - t.integer "image_width", limit: 4 t.string "provider_display_name", limit: 255 - t.string "actor_url", limit: 255 - t.string "objectId", limit: 255 t.string "root_guid", limit: 255 - t.string "status_message_guid", limit: 255 t.integer "likes_count", limit: 4, default: 0 t.integer "comments_count", limit: 4, default: 0 t.integer "o_embed_cache_id", limit: 4 t.integer "reshares_count", limit: 4, default: 0 t.datetime "interacted_at" - t.string "frame_name", limit: 255 t.string "facebook_id", limit: 255 t.string "tweet_id", limit: 255 t.integer "open_graph_cache_id", limit: 4 @@ -486,8 +473,6 @@ ActiveRecord::Schema.define(version: 20160720212620) do add_index "posts", ["guid"], name: "index_posts_on_guid", unique: true, length: {"guid"=>191}, using: :btree add_index "posts", ["id", "type", "created_at"], name: "index_posts_on_id_and_type_and_created_at", using: :btree add_index "posts", ["root_guid"], name: "index_posts_on_root_guid", length: {"root_guid"=>191}, using: :btree - add_index "posts", ["status_message_guid", "pending"], name: "index_posts_on_status_message_guid_and_pending", length: {"status_message_guid"=>190, "pending"=>nil}, using: :btree - add_index "posts", ["status_message_guid"], name: "index_posts_on_status_message_guid", length: {"status_message_guid"=>191}, using: :btree add_index "posts", ["tweet_id"], name: "index_posts_on_tweet_id", length: {"tweet_id"=>191}, using: :btree add_index "posts", ["type", "pending", "id"], name: "index_posts_on_type_and_pending_and_id", using: :btree