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: 20180920042415_create_user_uploads.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 CreateUserUploads < ActiveRecord::Migration[5.2]
  def up
    create_table :user_uploads do |t|
      t.integer :upload_id, null: false
      t.integer :user_id, null: false
      t.datetime :created_at, n
    
  def up
    create_table :user_uploads do |t|
      t.integer :upload_id, null: false
      t.integer :user_id, null: false
      t.datetime :created_at, null: false
    end

    add_index :user_uploads, %i[upload_id user_id], unique: true

    execute <<~SQL
      INSERT INTO user_uploads(upload_id, user_id, created_at)
      SELECT id, user_id, COALESCE(created_at, current_timestamp)
      FROM uploads
      WHERE user_id IS NOT NULL
    SQL
  end