The Ultimate Migration Generation Checklist
Maybe it’s a little presumptuous to call this the “ultimate” checklist, but then again, maybe not.
Whenever I need to generate schemas, I tend to overlook the same things over and over again, so I decided to put together a quick post to remind myself of some important considerations — just a few points to think about before pushing migrations to production.
1. Sketch the domain.
Use diagrams to sketch the domain and to figure out what tables you need. Using Google Docs is probably your best bet if you’re working with a team and
anyone on that team should be able to update the document. The ability to
embed a linked Google Drawing in a Google Doc in which you share other technical specifications is also a pro.
Sketch the tables and their columns and field types. Note where the foreign
keys live.
2. Add foreign key constraints.
In most cases, you want to guarantee referential integrity, right? If you
have one table that references another, you probably want to make sure that
a record cannot be inserted unless the referenced foreign key is present in the related table.