about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorDarius Kazemi <darius.kazemi@gmail.com>2019-04-30 15:29:28 -0700
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:15 -0500
commit6378feffa8935238bdb5f1f1c01fcb102440fe30 (patch)
treeb1eea210ace7eb72a00ab4604c3ec10c5ae4db4b /db/migrate
parent4eb49257fc618219709b357fb68f4d6156cab249 (diff)
[Feature, Federation, Port: hometown@b3e6597] Support locally cached inline images [+ Monsterfork additions]
Changes added by Monsterfork:
- Do not limit to only Articles
- Reuse existing media; retroactively using more-detailed descriptions
- Also scrub carrige returns between tags
- Handle download failures
- Attach to statuses and keep track of inlined media
- Handle local edits

Co-authored-by: Fire Demon <firedemon@creature.cafe>
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20200724035808_add_inline_to_media_attachments.rb7
-rw-r--r--db/migrate/20200724045955_create_inline_media_attachments.rb12
2 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20200724035808_add_inline_to_media_attachments.rb b/db/migrate/20200724035808_add_inline_to_media_attachments.rb
new file mode 100644
index 000000000..171eca4b5
--- /dev/null
+++ b/db/migrate/20200724035808_add_inline_to_media_attachments.rb
@@ -0,0 +1,7 @@
+class AddInlineToMediaAttachments < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured do
+      add_column :media_attachments, :inline, :boolean, default: false, null: false
+    end
+  end
+end
diff --git a/db/migrate/20200724045955_create_inline_media_attachments.rb b/db/migrate/20200724045955_create_inline_media_attachments.rb
new file mode 100644
index 000000000..a894c3868
--- /dev/null
+++ b/db/migrate/20200724045955_create_inline_media_attachments.rb
@@ -0,0 +1,12 @@
+class CreateInlineMediaAttachments < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def change
+    create_table :inline_media_attachments do |t|
+      t.references :status, index: { algorithm: :concurrently }, foreign_key: { on_delete: :cascade }
+      t.references :media_attachment, index: { algorithm: :concurrently }, foreign_key: { on_delete: :cascade }
+    end
+
+    add_index :inline_media_attachments, [:status_id, :media_attachment_id], unique: true, algorithm: :concurrently, name: 'uniq_index_on_status_and_attachment'
+  end
+end