You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20231103060018_fix_invalid_topic_user_bookmarked_data.rb
    path of file: ./repos/discourse/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class FixInvalidTopicUserBookmarkedData < ActiveRecord::Migration[7.0]
  def up
    DB.exec(<<~SQL)
      UPDATE topic_users
      SET bookmarked = true
      WHERE id IN (
        SELECT
          topic_users.id
        FROM topic_users
        INNE
    
  def up
    DB.exec(<<~SQL)
      UPDATE topic_users
      SET bookmarked = true
      WHERE id IN (
        SELECT
          topic_users.id
        FROM topic_users
        INNER JOIN bookmarks ON bookmarks.user_id = topic_users.user_id
        WHERE bookmarkable_type = 'Topic'
          AND bookmarks.bookmarkable_id = topic_users.topic_id
          AND topic_users.bookmarked = false
      ) AND topic_users.bookmarked = false
    SQL
  end