Attemping to generate a schema

Hi there,

I’m attempting to add attributes to a schema using an external configuration, but it appears the blocks passed into the DSL are stripped of their execution context.

Are there any other options for creating a schema? Is it possible to define a schema using a hash rather then using the DSL?

Here is simplified example:

require "rom"

attrs = [:one, :two, :three]

rom = ROM.container(:sql, 'sqlite::memory') do |config|
  class Tasks < ROM::Relation[:sql]
    schema(:tasks) do
      attrs.each do |attr|
        attribute attr, Types::String

rfb@simple:~/Projects/gpe$ ruby test.rb 
test.rb:9:in `block in <class:Tasks>': undefined local variable or method `attrs' for #<ROM::SQL::Schema::DSL:0x00007f53d8770c58> (NameError)

      attrs.each do |attr|
	from /home/rfb/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/rom-core-5.3.0/lib/rom/schema/dsl.rb:184:in `instance_exec'
	from /home/rfb/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/rom-core-5.3.0/lib/rom/schema/dsl.rb:184:in `call'

Also thank you to the creator and maintainers. This is an exceptional library!

Can you speak more about why you need to do this in the first place?

Generally, if you do not need to define the schema manually with the DSL, you ought to be able to just use infer: true to generate schema from the SQL information.