# typed: true
class AddKeywordsToDomainInkbunnyPosts < ActiveRecord::Migration[7.2]
  def change
    change_table :domain_inkbunny_posts do |t|
      t.references :deep_update_log_entry
      t.references :shallow_update_log_entry
      t.integer :num_favs
      t.integer :num_comments
      t.jsonb :keywords
    end

    change_table :domain_inkbunny_users do |t|
      t.references :deep_update_log_entry
      t.references :shallow_update_log_entry
    end

    add_foreign_key :domain_inkbunny_posts,
                    :http_log_entries,
                    column: :deep_update_log_entry_id,
                    primary_key: :id

    add_foreign_key :domain_inkbunny_posts,
                    :http_log_entries,
                    column: :shallow_update_log_entry_id,
                    primary_key: :id

    add_foreign_key :domain_inkbunny_users,
                    :http_log_entries,
                    column: :deep_update_log_entry_id,
                    primary_key: :id

    add_foreign_key :domain_inkbunny_users,
                    :http_log_entries,
                    column: :shallow_update_log_entry_id,
                    primary_key: :id
  end
end
