NAME
DBIx::Class::Tutorial::Appendix3 - Database design
Designing the database
If you already have a database you'd like to use and just want to get started, skip ahead to "DBIx::Class files overview".
If you have the luxury to be able to create and design your database layout from scratch then you should make the most of it and take your time to plan.
Follow the rules on Normalisation as much as you can, see http://b62.tripod.com/doc/dbbase.htm.
A few notes:
- Put all re-usable information layout data in separate tables. That is, if you have addresses for customers and addresses for companies, then have a separate address table. You can then add a column to your customers or companies containing an id pointing at the address table. This is called a foreign key.
- Try not to put more than one piece of data in a field. Don't be tempted to enter comma-separated-strings in a field, or a combination of other fields to make a unique field. Joining columns together later is easy, separating them is not.
- Always use descriptive column names, eg. use
parcel_count, not pact.
- Avoid columns with numeric suffixes, eg
phonenumber1 phonenumber2. Instead create a one-to-many related table.
Last modified:
Home