Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting a primary key as a foreign key reference, for m2m tables #52

Closed
simonw opened this issue Feb 8, 2024 · 1 comment
Closed
Labels
enhancement New feature or request
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Feb 8, 2024

Fixed this problem but found you cannot set a primary key as a foreign key reference, which prevents you from using this plugin to create a m2m table with foreign key references. I'll fix that in a separate issue.

Originally posted by @simonw in #51 (comment)

@simonw simonw added the enhancement New feature or request label Feb 8, 2024
@simonw simonw changed the title Support setting a primary key as a foreign key reference, for m2m tablen Support setting a primary key as a foreign key reference, for m2m tables Feb 8, 2024
@simonw
Copy link
Owner Author

simonw commented Feb 8, 2024

This currently isn't possible because of this code:

column_foreign_keys = [
{
"name": column["name"],
"foreign_key": foreign_keys_by_column.get(column["name"])[0]
if foreign_keys_by_column.get(column["name"])
else None,
"suggestions": [],
"options": integer_primary_keys
if column["type"] is int
else string_primary_keys,
}
for column in columns
if not column["is_pk"]
]

@simonw simonw closed this as completed in ba4a698 Feb 8, 2024
@simonw simonw added this to the 0.8 milestone Feb 9, 2024
simonw added a commit that referenced this issue Feb 18, 2024
Switch setup.py to pyproject.toml

Refs #22, #45, #46, #47, #49, #50, #51, #52, #53, #54, #55, #56, #57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant