0 votes

This may be a duplicate of: https://www.skipper18.com/support/2875/table-name-prefixes-for-each-bundle But instead of replying to a post 3 years old, I'd create a new one in hopes this is now possible.

It would be really nice to have the ability to specify a table prefix for all Entities within a Module (Laravel based project).

For example I'm working with networking / device data;
Device (physical) Ports; which are completely different from Network (tcp/udp) Ports. So I have two models in different namespaces with the same name. I know I can change the table name per-entity, but it would be nice to be able to implement a prefix on the Module and have it applied to all entities for consistency purposes.

I.E.
Module "Network" => prefix "network"
Module "Device" => prefix "device
"
Entity "Network\Port" automatically sets the table name to "networkport"
Entity "Device\Port" automatically sets the table name to "device
port"

in Feature Request by (120 points)

There are a few issues with such a solution.

The first is that Laravel doesn't support such thing directly, so we need to manually adjust table names on all export places as same in the migrations.

The second, more important. Where and how you want to automatically fill such prefix. In cases, when you also manually filled the table name property? Or in cases, when you didn't fill the table name property manually? Or in both cases?

This is very important. Because, when you manually enter the table name property, I believe Skipper should export exactly what you filled. But, when you didn't fill any table name, this should mean that you want to Laravel fill this property name automatically.

But this means several different rules on how table names are generated. There is one rule for common entities, another rule for MN/Pivot table names, and also other different singular/plural rules when some plugins are used.

So, to sum it up. Although this could seem like a good idea, such a feature can bring a lot of inconsistencies during generating such custom table names.

It's much better to fill every "table" property manually and have a clear insight into what is exported than some complex inner rules when to add a prefix, when not, when to generate table name in the singular form, and when in plural form.

Please log in or register to answer this question.