# Hanami Docs error (postgres UUID & Entity)

**URL:** <https://discourse.hanakai.org/t/hanami-docs-error-postgres-uuid-entity/323>\
**Category:** issues\
**Created:** [April 10, 2017, 1:17am UTC](https://discourse.hanakai.org/t/hanami-docs-error-postgres-uuid-entity/323 "2017-04-10T01:17:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![billiam](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/billiam/32/258_2.png) [@billiam](https://discourse.hanakai.org/u/billiam)\
**Post date:** [April 10, 2017, 1:17am UTC](https://discourse.hanakai.org/t/hanami-docs-error-postgres-uuid-entity/323/1 "2017-04-10T01:17:04Z")

</div>

Seems like they are typos, confused my newbie brain when following along.

In: [http://hanamirb.org/guides/models/postgresql/](http://hanamirb.org/guides/models/postgresql/)  
**UUID as Primary Key**

```ruby
    create_table :project_files do
      column :id, 'uuid', null: false, default: Hanami::Model::Sql.function(:uuid_generate_v4)
      column :name, String
    end

```

should be

```ruby
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

```bash
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](https://github.com/billiamliu/test_hanami_postgres)  
`$ rake test`

* * *

In: [http://hanamirb.org/guides/models/entities/](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.

---

<div class="post-metadata">

**Author:** ![jodosha](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/jodosha/32/710_2.png) [@jodosha](https://discourse.hanakai.org/u/jodosha)\
**Post date:** [April 18, 2017, 1:54pm UTC](https://discourse.hanakai.org/t/hanami-docs-error-postgres-uuid-entity/323/2 "2017-04-18T13:54:37Z")

</div>

@billiam Thank you very much. Fixed the guides: [https://github.com/hanami/hanami.github.io/commit/9f620eb4f7676493fa12a23db62b1f0cf46a6d48](https://github.com/hanami/hanami.github.io/commit/9f620eb4f7676493fa12a23db62b1f0cf46a6d48)

* * *

Regarding the entity suggested fix, we use “from” because you want to map in your entity the columns that you have in your database.
