Closed magec closed 2 years ago
Looking at the code, I would guess the table doesn't have a primary key. Is that the case?
The description of the table is as follows:
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
------------+-----------------------------+-----------+----------+--------------------+----------+--------------+-------------
name | character varying | | | | extended | |
created_at | timestamp without time zone | | | | plain | |
updated_at | timestamp without time zone | | | | plain | |
id | uuid | | not null | uuid_generate_v4() | plain | |
app_id | uuid | | not null | | plain | |
read_only | boolean | | | false | plain | |
is_active | boolean | | | | plain | |
Indexes:
"segments_pkey" PRIMARY KEY, btree (id, app_id)
"index_segments_on_app_id" btree (app_id)
Referenced by:
TABLE "app_exports" CONSTRAINT "app_exports_segment_id_fkey" FOREIGN KEY (segment_id, app_id) REFERENCES segments(id, app_id)
It has a composed primary key which acts as a foreing key from another table.
Sorry, I mean defined in ActiveRecord by ruby code.
Im going to close this, in the end, the reason behind was that the code I was working with had some monkeypatching on top of composite_primary_keys, mainly because it allows using 'single' primary key if there is an id field on the database. I have accommodated the thing to work after the upgrade.
Ok cool - thanks for the update.
Hello!
First of all, thanks for the gem!
Today I was trying to migrate a rails app from 5.1 to 5.2 and faced an issue related to
composite_primary_keys
.I am consistently getting:
When trying to create a new record using composite primary key
The offending line is this one
I did an small fix like:
And it seemed to work, but I didn't have time to really get into the thing. Any ideas on what this could be happening? I can't see any issue related to the one I'm having.