On Tuesday, April 24, 2018 at 1:21:52 PM UTC-7, Marcelo Pereira wrote: > > Hello, > > I'm running Sequel 5.6.0 and Ruby 2.5.1 and, when I try to create a > PostgreSQL enum, using the pg_enum extension, I get the following error. > > FrozenError: can't modify frozen > #<Class:#<Sequel::Postgres::Database:0x0000560dde548d68>> > > /usr/local/bundle/gems/sequel-5.6.0/lib/sequel/extensions/pg_enum.rb:112:in > `parse_enum_labels' > > Here is the minimum code that generates this error: > > Sequel.migration do > change do > create_enum(:transaction_status, %w[complete pending pending_publisher > ]) > end > end > > > I'm still trying to figure out what is going on and will post more > information if I find something. >
You are running on a frozen Database object, and create_enum modifies the object, so you get the FrozenError. A simple workaround with the current code would be to just not run migrations on a frozen Database. In terms of fixing the underlying issue, we'd have to not freeze @enum_labels, and instead use a mutex to access it. That should be fine as it is only used when parsing the schema. I'll make that change before the next release. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
