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

switching foreign key to a more universal and unique id which is geon… #290

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

abderraxim
Copy link

…ame_id as local id would mess up the related data on other models if database repopulation

…ame_id as local id would mess up the related data on other models if database repopulation
@jpic
Copy link
Member

jpic commented Jun 8, 2024 via email

@abderraxim
Copy link
Author

Yes indeed ,i will do that later

@jpic
Copy link
Member

jpic commented Jun 9, 2024 via email

@abderraxim
Copy link
Author

pardon me but i don't get the idea, if we're just switching to another key column , i'm not replacing the id key generated, but just defining the column to rely on

@jpic
Copy link
Member

jpic commented Jun 10, 2024 via email

@abderraxim
Copy link
Author

they should implement the migration or they can just explicitly specify the to_field and continue with the old model

    country = models.ForeignKey(
        Country, on_delete=models.DO_NOTHING, blank=True, null=True, to_field="id"
    )
    region = models.ForeignKey(
        Region, on_delete=models.DO_NOTHING, blank=True, null=True, to_field="id"
    )
    subregion = models.ForeignKey(
        SubRegion, on_delete=models.DO_NOTHING, blank=True, null=True, to_field="id"
    )
    city = models.ForeignKey(
        City, on_delete=models.DO_NOTHING, blank=True, null=True, to_field='id')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants