Skip to content

Problem with methods_in_migrations #7

@tycooon

Description

@tycooon
  1. Custom methods are not available in blocks like alter_table
  2. Kernel methods (like require) are not available in custom methods.
Sequel.migration do
  def test_method
    puts "hello"
  end

  up do
    alter_table :users do
      test_method # This causes NameError: undefined local variable or method `test_method' for #<Sequel::Postgres::AlterTableGenerator:0x00007ff229033680>
    end

    test_method # And this causes NoMethodError: undefined method `puts' for #<Sequel::MigrationDSL:0x00007f8af6874118>
  end
end

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions