Create table: Configure Setup with own defaults (fields, FKs...)
when creating a new table, many developers have default fields (triggers, indexes) they use: we need a setup based on a project where a new table is created based on a setup/config that was made before.
for example: every new table sould have 2 fields like:
- db_created (datetime)
- db_changed (datetime)
and also 2 triggers
- trdbchanged ---> SET db_changed = NOW() ....
the first field dbforge creates, is based on the table name, would
be great, if we could change that regex, for example:
if the table name is: "user" --> i always want the first field named based on this setup: %table%id so that the first field gets the name:
"userid"
next problem: foreign keys: the rule of creating them is also bad, because many times i get the error, that the FK name ist too long,
because the FK is based on the table names. a second solution could be, to build the FK names based on the PRIMARY-KEY of the 2 tables, for example:
table 1: userthisisaverylongtablenameforexample (userid)
table 2: rolesthisisaverylongtablenameforexample (roleid)
the FK would sound like:
FKuserthisisaverylongtablenameforexamplerolesthisisaverylongtablenameforexample...
better would be:
FKuseridroleid