Blog: Don't Do This At Home #4: Add Indices On Foreign Key Columns
Can you spot the problem in the following schema?
This schema is clearly designed for a MySQL database. It turns out that Propel already adds extra indices on every column bearing a foreign key when using MySQL. So the <index>
tag isn't necessary. You can remove it and reduce the table schema to:
Remember: every line you write is a line you must maintain. Try to keep your files (code and configuration files) as small as possible. And try to remove unnecessary lines during regular cleanup sessions. These sessions, producing "red" commits (i.e. commits with a lot of removed code) feel very satisfactory, since they free your mind from future problems.