From b6cc3ebb9a1456b056873e2f41d3628f1052e6fb Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Wed, 22 Jul 2020 09:15:10 -0500 Subject: [PATCH] [deploy] Optimization:Change Podcast and Episode PKs to Bigints (#9423) --- ...200721213341_change_podcast_p_ksto_bigint.rb | 17 +++++++++++++++++ db/schema.rb | 8 ++++---- 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20200721213341_change_podcast_p_ksto_bigint.rb diff --git a/db/migrate/20200721213341_change_podcast_p_ksto_bigint.rb b/db/migrate/20200721213341_change_podcast_p_ksto_bigint.rb new file mode 100644 index 000000000..9e49ae0ee --- /dev/null +++ b/db/migrate/20200721213341_change_podcast_p_ksto_bigint.rb @@ -0,0 +1,17 @@ +class ChangePodcastPKstoBigint < ActiveRecord::Migration[6.0] + def up + safety_assured { + change_column :podcasts, :id, :bigint + change_column :podcast_episodes, :id, :bigint + change_column :podcast_episodes, :podcast_id, :bigint + } + end + + def down + safety_assured { + change_column :podcasts, :id, :int + change_column :podcast_episodes, :id, :int + change_column :podcast_episodes, :podcast_id, :int + } + end +end diff --git a/db/schema.rb b/db/schema.rb index be85069fe..7461678f4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_07_20_213710) do +ActiveRecord::Schema.define(version: 2020_07_21_213341) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -823,7 +823,7 @@ ActiveRecord::Schema.define(version: 2020_07_20_213710) do t.index ["slug"], name: "index_pages_on_slug", unique: true end - create_table "podcast_episodes", id: :serial, force: :cascade do |t| + create_table "podcast_episodes", force: :cascade do |t| t.boolean "any_comments_hidden", default: false t.text "body" t.integer "comments_count", default: 0, null: false @@ -834,7 +834,7 @@ ActiveRecord::Schema.define(version: 2020_07_20_213710) do t.string "image" t.string "itunes_url" t.string "media_url", null: false - t.integer "podcast_id" + t.bigint "podcast_id" t.text "processed_html" t.datetime "published_at" t.text "quote" @@ -855,7 +855,7 @@ ActiveRecord::Schema.define(version: 2020_07_20_213710) do t.index ["website_url"], name: "index_podcast_episodes_on_website_url" end - create_table "podcasts", id: :serial, force: :cascade do |t| + create_table "podcasts", force: :cascade do |t| t.string "android_url" t.datetime "created_at", null: false t.integer "creator_id"