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

changed incorrect ManyToMany fields #245

Merged
merged 6 commits into from
Jul 8, 2024
Merged

Conversation

purple-void
Copy link
Collaborator

I changed incorrect ManyToMany fields to ForeignKey's (Django's way of ManyToOne).

This includes:
-posts, saved_posts, private_posts, upvotes, and downvotes in UserProfile
-upvotes and downvotes in Posts

Example:
Before, posts were labeled as ManyToMany, meaning that a UserProfile can have many posts (makes sense), but a post can have many UserProfiles (doesn't make sense).

This coincidentally helps with reducing the amount of tables we will use, although this doesn't solve the #229.

EDIT: we renamed that branch to be accurate, so this is a new pull request.

Copy link

vercel bot commented Jul 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rebutify ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 8, 2024 3:37pm

@purple-void purple-void self-assigned this Jul 3, 2024
@purple-void purple-void requested review from seporterfield and Monstarrrr and removed request for seporterfield July 3, 2024 02:28
@purple-void purple-void added bug Something isn't working [ backend / labels Jul 3, 2024
@purple-void purple-void marked this pull request as ready for review July 3, 2024 02:31
@purple-void
Copy link
Collaborator Author

Copy link
Owner

@Monstarrrr Monstarrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change many-to-one into one-to-many

@purple-void
Copy link
Collaborator Author

this is NOT ready yet

@Monstarrrr
Copy link
Owner

this is NOT ready yet

Oh sorry lol, can you set it as draft? I don't see it as draft on phone

@purple-void purple-void marked this pull request as draft July 4, 2024 23:30
@purple-void
Copy link
Collaborator Author

now this PR is ready for review

@seporterfield seporterfield dismissed Monstarrrr’s stale review July 7, 2024 20:30

change went through

Copy link
Collaborator

@seporterfield seporterfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was worried about the migration files at first since we just pushed changes to main from another branch with the same numbers on their migration files.

But that's no problem:

Don’t worry - the numbers are just there for developers’ reference, Django just cares that each migration has a different name. Migrations specify which other migrations they depend on - including earlier migrations in the same app - in the file, so it’s possible to detect when there’s two new migrations for the same app that aren’t ordered.

When this happens, Django will prompt you and give you some options. If it thinks it’s safe enough, it will offer to automatically linearize the two migrations for you. If not, you’ll have to go in and modify the migrations yourself

@purple-void purple-void merged commit b40bdee into main Jul 8, 2024
10 checks passed
@purple-void purple-void deleted the fix/229_many_to_many branch July 8, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ backend / bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants