From 86346ad04bf873deb5bfc6f53eb054b9d91e67d9 Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Sat, 3 Aug 2024 19:22:15 +0200 Subject: [PATCH] Add image_remote_url to PreviewCard --- app/models/preview_card.rb | 1 + ...3160904_add_image_remote_url_to_preview_cards.rb | 13 +++++++++++++ db/schema.rb | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240803160904_add_image_remote_url_to_preview_cards.rb diff --git a/app/models/preview_card.rb b/app/models/preview_card.rb index 5a11351e588..c5ef3ac1656 100644 --- a/app/models/preview_card.rb +++ b/app/models/preview_card.rb @@ -33,6 +33,7 @@ # published_at :datetime # image_description :string default(""), not null # author_account_id :bigint(8) +# image_remote_url :string # class PreviewCard < ApplicationRecord diff --git a/db/migrate/20240803160904_add_image_remote_url_to_preview_cards.rb b/db/migrate/20240803160904_add_image_remote_url_to_preview_cards.rb new file mode 100644 index 00000000000..d727324f2ce --- /dev/null +++ b/db/migrate/20240803160904_add_image_remote_url_to_preview_cards.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddImageRemoteURLToPreviewCards < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def up + safety_assured { add_column :preview_cards, :image_remote_url, :string } + end + + def down + remove_column :preview_cards, :image_remote_url + end +end diff --git a/db/schema.rb b/db/schema.rb index d4796079cae..64563ad4e5b 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[7.1].define(version: 2024_07_24_181224) do +ActiveRecord::Schema[7.1].define(version: 2024_08_03_160904) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -880,6 +880,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_24_181224) do t.datetime "published_at" t.string "image_description", default: "", null: false t.bigint "author_account_id" + t.string "image_remote_url" t.index ["author_account_id"], name: "index_preview_cards_on_author_account_id", where: "(author_account_id IS NOT NULL)" t.index ["url"], name: "index_preview_cards_on_url", unique: true end