Skip to content

Commit 3a933fd

Browse files
Add Module and Table Naming Conventions for 3rd parties (#30)
* Add Module and Table Naming Conventions for 3rd parties * fix: move warning block to more logical spot. * refactor: change a few additional lines. --------- Co-authored-by: Nabeel S. <[email protected]>
1 parent 9611271 commit 3a933fd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/developers/addons.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ see the source for the module,
3434

3535
:::
3636

37+
:::tip
38+
39+
When naming your module, it is recommended that if your module name runs the risk of being generic, to prefix your module name with a unique identifier. For example, instead of naming your module `Tours`, name it `XXTours` (The XX in the example being the identifier or brand name you choose)
40+
41+
In doing this, you reduce the chance of your module name conflicting directly with another module.
42+
43+
:::
44+
3745
---
3846

3947
## Namespacing
@@ -197,6 +205,8 @@ if(Auth::check())
197205

198206
# Database Access
199207

208+
209+
200210
## Models
201211

202212
Models are the more basic way to access your database tables. For example, if
@@ -300,6 +310,17 @@ it's seen that it's already run the file, it won't run it again.
300310

301311
:::
302312

313+
:::warning[Table Name Convention]
314+
315+
When naming tables, table names *should* be prefixed with a short indentifier that is unqiue to your addon or group of addons (e.g. `disposable_`, `ch_`, `sp_`, etc.). For example, instead of naming a table `tours`, name it `ch_tours`. This includes pivot tables. See Laravel documentation on how to override the default conventions for table names, foreign relationships, etc. where required.
316+
317+
Not prefixing your tables could lead to unintended consequences, including but not limited to:
318+
319+
* Conflicting with future phpVMS core features that would use the same table name, thereby making it more difficult to update phpVMS at a later date.
320+
* Conflicting with other addons by other 3rd party modules that don't head this warning.
321+
322+
:::
323+
303324
### Seeding Data
304325

305326
I've added a few extra features, including adding seed data, including adding

0 commit comments

Comments
 (0)