Skip to content
This repository was archived by the owner on Mar 15, 2021. It is now read-only.
This repository was archived by the owner on Mar 15, 2021. It is now read-only.

ActiveRecord view backed model with custom primary key #310

@2009

Description

@2009

First a bit of context, I have a fabricator for an ActiveRecord model that is backed by a materialized view which has both an id column and pk column (my custom primary key column).

I run into the issue where setting the pk or id results in both fields being set to the same string value, so my id column ends up with a string value when it should be an integer.

       Column        |            Type             | Collation | Nullable | Default | Storage  | Stats target | Description
---------------------+-----------------------------+-----------+----------+---------+----------+--------------+-------------
 pk                  | text                        |           |          |         | extended |              |
 id                  | integer                     |           |          |         | plain    |              |

Ultimately I want to be able to test I get the right data back when I perform a sql join on id column of the materialized view.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions