Use postgis datatypes


#1

Hello,

I would like to use postgis data types, I’ve created migration:

Hanami::Model.migration do
  up do
    execute 'CREATE EXTENSION IF NOT EXISTS "postgis"'
    create_table :places do
      primary_key :id

      column :coordinates, 'geometry(POINT,4326)'

      column :created_at, DateTime, null: false
      column :updated_at, DateTime, null: false
    end
  end

  down do
    drop_table :places
    execute 'DROP EXTENSION IF EXISTS "postgis"'
  end
end

I’ve added attributes mapper to Entity:

class Place < Hanami::Entity
  attributes do
    attribute :coordinates, Types::String
  end
end

When I start the server or console, I get the error:

/Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-model-1.0.0/lib/hanami/model/configuration.rb:144:in `rescue in load!': missing attributes in ROM::Relation::Name(places) schema: :coordinates (Hanami::Model::Error)
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-model-1.0.0/lib/hanami/model/configuration.rb:134:in `load!'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-model-1.0.0/lib/hanami/model.rb:79:in `load!'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components/components.rb:83:in `block (2 levels) in <module:Components>'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components/component.rb:44:in `call'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:85:in `block (2 levels) in resolve'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:133:in `block in fetch_or_store'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:122:in `fetch'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:132:in `fetch_or_store'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:83:in `block in resolve'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `each'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `resolve'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components/component.rb:138:in `resolve_requirements'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components/component.rb:36:in `call'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:85:in `block (2 levels) in resolve'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:133:in `block in fetch_or_store'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:122:in `fetch'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:132:in `fetch_or_store'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:83:in `block in resolve'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `each'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `resolve'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/commands/command.rb:57:in `initialize'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/commands/console.rb:52:in `initialize'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/cli.rb:89:in `new'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/lib/hanami/cli.rb:89:in `console'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/gems/hanami-1.0.0/bin/hanami:5:in `<top (required)>'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/bin/hanami:22:in `load'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/bin/hanami:22:in `<main>'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
	from /Users/mikolaj/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'

It is my first Hanami project, how can I add custom data type serializer?