When adding or altering model schemas in Django, developers typically generate and commit accompanying migration files. But, counterintuitively, Django wants to track all model changes in migration files, even if they don’t result in database schema changes. Those can be easy to miss.
Regardless the reason, you never want your repo to be in a state where migrations are detected as needed, but accompanying migration files aren’t committed.
Writing a pytest test that can be triggered on github, Circle, Travis, Jenkins, or whatever you use turns out to be trivial, but I couldn’t find documentation or examples on the interwebs, so am posting this here for posterity:
from django.core.management import call_command
""" If no migrations are detected as needed, `result`
will be `None`. In all other cases, the call will fail,
alerting your team that someone is trying to make a
change that requires a migration and that migration is
result = call_command("makemigrations", check=True, dry_run=True)
assert not result
It really is that simple! If no migrations are needed, result will be None. Any other return value means someone should run ./manage.py makemigrations to see what’s missing, and commit the results.
Cycling Pt. Reyes/Petaluma today, stopped off to check out a trailhead I hadn’t seen before, when suddenly I heard a band. Just over the hill, this family – Mom and Dad and two daughters – shooting a music video out in the middle of nowhere. “El Radio Fantastique” they call themselves. As Beefheart said, “Practice in front of a bush.”
Felt a bit embarrassed when I realized too late that they were in the middle of filming a music video – I had thought the guy with the smartphone was another hiker surprised to find a band playing on the trail! My apologies to the band if I interrupted your creative flow.
More about the band here. Listen on Apple Music here.
Used to be that Beyond meats were available in the grocery store, but you had to go to a restaurant to try Impossible Burgers. But recently I found Beyond and Impossible side-by-side in the grocery store, and bought one of each. Last night I set up a little taste comparison test for family.
Setup: Two patties the same size. Added the same amount of salt and pepper to each, grilled them at same temperature for the same length of time (3 mins/side). We tasted them as-is: No condiments or extras to get in the way of taste.
My wife and son didn’t know which patty was which. To make things fair for my own opinion, I left the room and asked them to flip a coin to decide whether to switch the labels on the plates or not.
Conclusion: We all thought Impossible was slightly sweeter, and sure enough, the label shows that it contains a bit of sugar. We all though Beyond was slightly more chewy, and sure enough, it turns out to contain a bit more fat. Impossible had a bit more native seasoning – a flavor that’s hard to put your finger on, but good. Impossible was also more reddish in color (beet juice, right?) but Beyond had a slightly more realistic taste, if that’s what you’re going for.
At the end of the sampling, we all agreed that if a store had both and they cost roughly the same, we would choose Beyond over Impossible (consensus!). We thought Beyond was more delicious by a shade, despite the fact that Impossible has more seasoning built in. But both are delicious, and it’s gotten really hard to justify the eco- and health-costs of buying hamburger meat when products like these are available.
In the summer of 2016, I asked who wanted to try riding the Morro Bay Lighthouse Century with me in October (100-mile bike ride up the Pacific Coast Highway) . Rowan raised his hand and told me that the ride would mark the anniversary of his double lung transplant, and that he liked to celebrate each anniversary by doing something physically difficult — it was his way of showing that not only had he stayed alive against the odds, but that he was fully embracing life, living every experience to the max.
Our kids had gone through elementary school together, but I’d never really gotten to know him. Over the next few months, we did a series of training rides together, all over the East Bay, plus an unforgettable climb to the top of Mt. Tamalpais in dense fog. In the course of those rides, through all kinds of weather, through intense sweat and crazy descents, I got to know Rowan and was blown away daily by his relentless joy and optimism, his profound appreciation for his lung donor, and for the second chance at life he’d been gifted. Rowan became a sort of role model for me, an example of how we all ought to be living.
That October, we traveled to Morro Bay together and shared a hotel, then rode with another friend the next morning. Rowan wasn’t the fastest guy on the course – he was riding with the lungs of a 16-year-old girl! – but he was steady and determined, and there was never any question that he’d finish. The minute his odometer rolled over to that 100-mile mark, we stopped and high-fived each other and he let out a huge whoop of joy.
When I heard the news today that Rowan had passed, I broke down in my wife’s arms. This cruel world has taken one of our brightest beacons. I’ll remember you forever Rowan – thanks for sharing that incredible adventure with me, and for sharing your bounty of optimism with all of us.
Enjoying all of the nostalgia around MAD Magazine, and the bummer of it closing down last week. In a weird way, I learned a lot about the world around me as a young teen reading MAD (including how to disco dance by kicking your feet up in the air above your head, which I actually did at my first dance, thanks MAD!) Anyway, this was my dear Aunt Gerry, reading issue 79 (June 1963) at the hairdresser. Family heirloom.
Fun fact: Jimmy Carter got the U.S. started on conversion to the metric system, but didn’t have time to finish. Then Reagan came along and pulled the plug on us matching the rest of the world in sensible measurements. We coulda been there by now. Carter also installed solar panels on the white house, then Reagan moved in and pulled ’em off. Progress vs. regress, ’twas ever thus.
Someone else’s tweet: “All our refusal to adopt the metric system has done is make our products more expensive at home and massively less desirable in foreign countries. But yeah, let’s keep measuring shit by how many barley-corns can fit on the King’s finger. For freedom. “
The one thing an OFF button should never do is make things worse. But the boron control rods designed to regulate the nuclear reaction in Soviet RNKB reactors had a fatal flow – to save money, they were tipped with graphite rather than boron. Under certain insane conditions, when all water is already removed, this has the effect of briefly mushrooming heat levels, leading to catastrophic failure. But why had the water been removed at Chernobyl? Because a party apparatchik was obsessed with completing a test to earn a commendation. And because some of the plant operators were barely trained.
Technical flaw combined with human hubris combined with penny pinching. Anyway, CHERNOBYL on HBO is now over, but will remain available forever. Everything this graphic says is true. Don’t look for a pro- or anti-nuke docudrama — it’s not that. Just one of the most important true stories of the last century. So good.