Our table is looking good so far, but there’s a looming problem that will start to bite us before too long. We didn’t add any indexes, which will slow down our queries substantially. Let’s fix that now.
Edit a Migration or Create a New One?
This change brings up an interesting question: should we generate a new migration to add these indexes, or should we just edit the migration that we already made?
As a general rule, it’s OK to edit an existing migration provided that you haven’t already committed your migration to source control. Once your migration is available to other developers on your team, you shouldn’t make any edits to it—you should instead create a new migration with the changes you want to make.
The reason is a ...