annotaterb icon indicating copy to clipboard operation
annotaterb copied to clipboard

Add support for printing enum types

Open schpet opened this issue 11 months ago • 1 comments

given rails has more support for postgres enums it would be nice if annotate included more info for a given enum, e.g. given i have a migration like this

    create_enum :billing_method, %w[agency_bill direct_bill_to_insured]
    add_column :policies, :billing_method, :enum, enum_type: :billing_method, null: true

we get an annotation like this:

# == Schema Information
#
# Table name: policies
#
#  id                             :uuid             not null, primary key
#  billing_method                 :enum

it would be nice to get more info on the enum, e.g.

# == Schema Information
#
# Table name: policies
#
#  id                             :uuid             not null, primary key
#  billing_method                 :enum             enum_type: billing_method
#
# Enums
#
#  billing_method  agency_bill, direct_bill_to_insured

schpet avatar Jan 15 '25 20:01 schpet

Hi @schpet thanks for submitting a detailed request. I think it shouldn't be too hard to add, but at the moment I do not have the time to work on it.

However, I am adding labels to invite anyone to submit a PR for it. If you want to take a stab at adding the feature I would definitely be able to provide support there.

drwl avatar Feb 17 '25 03:02 drwl