how to rename a table in ruby

# Step 1: Create a new migration file
rails generate migration RenameOldTableNameToNewTableName

# Step 2: Open the generated migration file in the 'db/migrate' directory
# and use the `rename_table` method to specify the old and new table names
class RenameOldTableNameToNewTableName < ActiveRecord::Migration[6.0]
  def change
    rename_table :old_table_name, :new_table_name
  end
end

# Step 3: Run the migration to apply the changes to the database
rails db:migrate