Databases
The more you normalize it will be more DRY, but it will be harder to understand and would slow performance. It is an equivalent to creating abstractions.
- Create a separate table for each set of related data.
- Identify each set of related data with a primary key.
- It complies with 1NF
- All the non-key attributes should be dependent on a key.
- If there is a key that has no relationship or is unnecessary, it should be pulled out into another table.
- It complies with 2NF
- Split the table as much as possible. Prefer leaving keys instead of values.
- AWS RDS
- Each time there is a change in the structure of the database (eg. create a table, delete a column, etc) you should append the command in a historic of SQL commands.
- Enumerate all the commands
- Run through all the commands
- Save the index number of the last command executed.
- Next time you run the migrator, it should start running from the last command that it previously ran.
- This will ensure that you aren’t running commands that don’t need to be executed.