When trying to create let say a role table and permission table with the relation role->permissions, when using the prefix to name the tables and using the same to set the foreign_key produce the error:
prefix = "rol"
Foreign key associated with column 'rol_permissions.role_id' could not find table 'rol_roles' with which to generate a foreign key to target column 'id'
If I change the f"{prefix}_roles" with "rol_roles" both in the name and the foreign key it works.
Is there a flag or what can I do to maintain the same code and have relationship between tables?
What about using relationship between models from different models?
When trying to create let say a role table and permission table with the relation role->permissions, when using the prefix to name the tables and using the same to set the foreign_key produce the error:
prefix = "rol"
Foreign key associated with column 'rol_permissions.role_id' could not find table 'rol_roles' with which to generate a foreign key to target column 'id'
If I change the f"{prefix}_roles" with "rol_roles" both in the name and the foreign key it works.