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

ActiveRecord view backed model with custom primary key #310

Open
2009 opened this issue Jun 12, 2018 · 1 comment
Open

ActiveRecord view backed model with custom primary key #310

2009 opened this issue Jun 12, 2018 · 1 comment

Comments

@2009
Copy link

2009 commented Jun 12, 2018

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.

@paulelliott
Copy link
Owner

@2009 Can you post the content of the fabricator in question?

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants