PMA has the tools for adding the central columns. As far as I understand, it's used with foreign constraints. I have two tables: TableA
and TableB
.
Structure of TableA
: id_of_A
, name_of_A_value
, ...
Structure of TableB
: id_of_B
, foreign_id_of_A
,...
and foreign constraint from foreign_id_of_A
to A-table
.id_of_A
.
And it's very difficult to select needed foreign_id_of_A
while insert new row into TableB
because only value of id_of_A
is visible. Could central columns help me with this problem? How central column works?
Central Column
You can add/remove columns to the list as per your requirement. These columns in the central list will be available to use while you create a new column for a table or create a table itself. You can select a column from central list while creating a new column, it will save you from writing the same column definition over again or from writing different names for similar column.
To allow the usage of this functionality:
set up
$cfg['Servers'][$i]['pmadb']
and the phpMyAdmin configuration storageput the table name in
$cfg['Servers'][$i]['central_columns']
(e.g. pma__central_columns)
This feature can be disabled by setting the configuration to false.
Perhaps the feature that you are looking for is the "Display Column" under "Relation View" in the table structure view. This allows you to choose what column is shown in the PHPMyAdmin interface regardless of what is stored in the database foreign key constraint.
If the line is not shown than you need to enable the feature in PHPMyAdmin. See the FAQ Entry and relevant configuration option entries:
$cfg["servers"][$i]["relation"]
and$cfg["servers"][$i]["table_info"]
(in the previous link, at the time of posting (I don't have enough reputation to post more than 2 links)).Essentially you create a couple of tables in a database that PHPMyAdmin can use to store additional data and then tell it which tables these are. Once this is done PHPMyAdmin will let you choose which columns to display (on mouse over of the linked column, and while editing data). If you installed it on a Linux distribution via a package manager it should have already created these tables for you (or at least asked you if you wanted to), if it did not, re-installing the package may help. I don't have any experience with installing it on Windows or Mac OS X, but I would presume that there is some automated method of creating these tables for those platforms.
(On Debian and Debian-based Linux Distributions (such as Ubuntu), the extra database is configured with
db-config-common
. If it was not configured at install time,dpkg-reconfigure phpmyadmin
will allow you to set up the database (please note that this might destroy some user/system preferences in PHPMyAdmin).)I've found here is an exhaustive description:
http://lees.geo.msu.edu/phpmyadmin/doc/html/faq.html
May be it's useful for foreign constraints modelling, but absolutly useless in usage. I'm still looking for a solution for adding value into one table by the ID from another table so that it was understandable for people, not for computers. If you know how to do that, let me know.