Soft foreign key detectors are used with soft foreign keys.
Some database engine does not support foreign key constraints. Or a database may be created by inexperienced developers, which don't know about foreign keys constraints... and someone asks you to work on the database.
In this case, you typically adopt a naming convention that allows the reader to detect foreign keys.
For example : "fk_product_price"
(declared in the table "command
") is a foreign key. It is associated to a join from the "dependent" table "command
" to the "reference" field "price
" (within the "reference" table "product
)".
DbView provides a set of detectors. Each detector is associated with a naming convention. You can get the list of all available detectors by typing the following command:
dbview.bat list-soft-key-detectors
dbview.sh list-soft-key-detectors
dbview.sh list-soft-key-detectors
You get something like this:
Name | Description |
---|---|
target-table-name-us-id |
This dectector assumes that you use the following naming convention for foreign keys :
For example, if DbView comes across the field " |
id-us-target-table-name |
This dectector assumes that you use the following naming convention for foreign keys :
For example, if DbView comes across the field " |
fk-target-table-name |
This dectector assumes that you use the following naming convention for foreign keys :
And it assumes that the name of the "reference" field is always "id". For example, if DbView comes across the field " |
fk-us-target-table-name |
This dectector assumes that you use the following naming convention for foreign keys :
And it assumes that the name of the "reference" field is always "id". For example, if DbView comes across the field " |
id-target-table-name |
This dectector assumes that you use the following naming convention for foreign keys :
And it assumes that the name of the "reference" field is always "id". For example, if DbView comes across the field " |
For information, all the soft key detectors are packed into a JAR file :
extensions/softForeignKeyDetectors.jar
You can print the content of this file by using the Java archiver (aka "jar").
jar tvf extensions\softForeignKeyDetectors.jar
The above list of foreign key detectors does not cover all the possible naming conventions.
Adding a new detector is made easy if you have some basic knowledge in JAVA. Adding a new detector is a three-step procedure:
org.dbview.resources.softforeignkeydetectors
).jar uf softForeignKeyDetectors.jar youNewDetector.class
).