bibendi / activerecord-postgres_enum

Integrate PostgreSQL's enum data type into ActiveRecord's schema and migrations.
MIT License
361 stars 24 forks source link

Rails 7 create_enum generates array of arrays in schema.rb #55

Closed dpaluy closed 2 years ago

dpaluy commented 2 years ago

After migrating from Rails 6.1 to Rails 7 and updating this gem to 2.0.0 the schema.rb isn't generated correctly.

My migration is:

class AddMood < ActiveRecord::Migration[7.0]
  def change
    create_enum :mood, %w(happy great been_better)
  end
end

The schema.rb result is:

ActiveRecord::Schema.define(version: 2021_12_24_061446) do
  create_enum :mood, [["happy", "great", "been_better"]]
end

This double array fails when running: rake db:schema:load

Expected behavior

ActiveRecord::Schema.define(version: 2021_12_24_061446) do
  create_enum :mood, ["happy", "great", "been_better"]
end

Context (please complete the following information):

bibendi commented 2 years ago

Thank you for the reporting! Can you try fix/rails-7-schema-dumper branch?

dpaluy commented 2 years ago

@bibendi Your fix works correctly. Thank you for the prompt fix

bibendi commented 2 years ago

Cool. I'll release the gem now.