Seems like they are typos, confused my newbie brain when following along.
In: http://hanamirb.org/guides/models/postgresql/
UUID as Primary Key
create_table :project_files do
column :id, 'uuid', null: false, default: Hanami::Model::Sql.function(:uuid_generate_v4)
column :name, String
end
should be
primary_key :id, 'uuid', null: false, default: Hanami::Model::Sql.function(:uuid_generate_v4)
When it’s using column
, :id
is correctly a UUID but repo cannot find by id
Hanami::Model::MissingPrimaryKeyError: Missing primary key for :teachers
/usr/local/lib/ruby/gems/2.4.0/gems/hanami-model-1.0.0/lib/hanami/repository.rb:404:in `rescue in find'
/usr/local/lib/ruby/gems/2.4.0/gems/hanami-model-1.0.0/lib/hanami/repository.rb:402:in `find'
It’s fixed when using primary_key
Quick demo: https://github.com/billiamliu/test_hanami_postgres
$ rake test
In: http://hanamirb.org/guides/models/entities/
Custom schema takes precedence over automatic schema. If we use custom schema, we need to manually add all the new columns from the corresponding SQL database table.
Should be:
Custom schema takes precedence over automatic schema. If we use custom schema, we need to manually add all the new columns to the corresponding SQL database table.