sqlboiler
sqlboiler copied to clipboard
Partition Table Unable To Generate Relationships
If you're having a generation problem please answer these questions before submitting your issue. Thanks!
What version of SQLBoiler are you using (sqlboiler --version)?
SQLBoiler v4.10.2
What is your database and version (eg. Postgresql 10)
psql (PostgreSQL) 13.6 (Debian 13.6-1.pgdg100+1)
Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
CREATE TABLE field_entity_values ( account_id CHARACTER(26) NOT NULL, entity_type ENTITY_TYPE NOT NULL, entity_id CHARACTER(26) NOT NULL, field_type FIELD_TYPE NOT NULL, field_id CHARACTER(26) NOT NULL, idx_value_id CHARACTER(26) DEFAULT NULL, value_id CHARACTER(26) DEFAULT NULL, PRIMARY KEY (account_id, entity_type, entity_id, field_type, field_id), CONSTRAINT FK_FIELD_ENTITY_VALUES_ENTITY_ID FOREIGN KEY (entity_id) REFERENCES entities(id), CONSTRAINT FK_FIELD_ENTITY_VALUES_FIELD_ID FOREIGN KEY (field_id) REFERENCES fields(id) ) PARTITION BY list (entity_type);
Further information. What did you do, what did you expect?
Hello,
I have an interesting experience here where I've discovered that a partitioned table is unable to generate the relationships.
When I have the partitioned table in the database, I get the following in the generated models:

However, when I remove the partition from the table, I get the following:

So, my question comes down to 2 things:
- Are relationships supported on Partitioned tables?
- Alternatively, is this a bug?
Look forward to your response.
Personally, I haven't used partitions with SQLBoiler so this is not a situation that I have faced.
I could be wrong, but reading through the code, I also don't remember seeing any code specifically about handling partitions, so maybe it had never been supported.
Is there any chance this could be implemented if that's the case?
Hey @stephenafamo is there any chance this could be looked into?
Still haven't had time to look into a lot of things, and since partitions are not something I use, I don't see myself looking into this for a while.
I have added the help wanted label in case anyone can help.
If you can get to the root of the issue, or a full implementation, I'll be happy to merge a PR
No worries, I understand. If I get a chance of the W/end I'll see if I can see what's happening