I am structuring a modular php application using MySQL as my database.
I would prefer to use redbean as my ORM library.
Version 2 allows me to introduce my own way of naming things while version 3 removes this ability and uses a default naming convention for all tables.
I am now trying to determine a way to name my tables and then decide whether I will use version 3 or version 2.
I am considering the following schema:
-
Core components
- account
- emailaddress
- etc.
-
Modules
- ecommerce_product
- ecommerce_order
- account_ecommerce_order (link table with core table)
- ecommerce_order_ecommerce_product (link table between module tables)
Should I prefix my “core” tables with “core_”?
I like having prefixes for my modules as it is quite easily to determine whether a table belongs to a module or the core app. Are there any reasons against this?
The link tables bothers me some what as they can be excessively long. Are there any ways to make this better?
I decided to go with the table names above and have migrated to RedBean 3.
After thinking about it, I felt that prefixes for core components are not entirely useful. It is also longer to type
$account = R::dispense('core_account')compared to$account = R::dispense('account').The
core_prefix does not add any syntatic value or enhance readability.Prefixing my modules
ecommerce_productetc, is actually quite useful and enhances readability. When referencing anecommerce_product, one can immediately know that it is part of the ecommerce module.