logo
podcast Podcast
get help Get Unstuck

Don't let one-time commands stick around forever

Tidy up after yourself

Joel Clermont
Joel Clermont
2024-12-31

A while back, I talked about some strategies for minimizing risk with production data transformations. The main strategy I shared was to write a one-time command to handle the data transformation instead of doing it in a migration or with ad-hoc queries.

But this raises another question: what do you do with that one-time command after you've run it?

My recommendation is to open up a ticket to delete it so you don't forget about it and let it stick around forever.

By creating the ticket, you're not feeling the need to rush and delete it immediately. You can clean it up as part of a future commit after you've verified that the data transformation was successful and that the command is no longer needed.

What's the danger of leaving it around? Besides just cluttering up the codebase with unnecessary commands, you run the risk of someone later thinking it is meant to be run again.

You can avoid some of that confusion by giving the command a name that makes it clear it's meant to be used one time, but honestly it's just best to clean it up sooner than later.

Here to help,

Joel

P.S. Has your codebase accumulated some technical debt? Are you ready to pay down that debt and get your team's productivity back? Let's talk about how we can help.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice you can use.