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: 20131017014509_add_post_count_to_categories.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 AddPostCountToCategories < ActiveRecord::Migration[4.2]
  def up
    add_column :catego
    
  def up
    add_column :categories, :post_count, :integer, null: false, default: 0
    execute <<SQL
    UPDATE categories
    SET post_count = (SELECT COALESCE(SUM(posts_count),0) FROM topics
                      WHERE category_id = categories.id AND deleted_at IS NULL)
SQL
  end