DEV Community

Matt Layman
Matt Layman

Posted on • Originally published at mattlayman.com

1

Remodeling Data Relationships - Building SaaS #55

In this episode, we're remodeling! I changed the model relationship between GradeLevel and Course from a ForeignKey (1 to many) to a ManyToManyField. We talked through the change and started fixing all the tests that broke.

After explaining the change that I wanted to make and why I want to make it, I explained how a foreign key and many to many relationship at the database level.

Once we had the conceptual foundation in place, I started with the documentation. We looked at the ManyToManyField and what changes were needed to convert a ForeignKey to a ManyToManyField.

After the change, we immediately saw the value of having a test suite that runs all the code. We ran the tests and see the test suite light up like a Christmas tree with errors.

For the remainder of the stream, I worked to fix errors in the suite by fixing the broken code and the broken tests.

This article first appeared on mattlayman.com.

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay