On Fri, Jul 25, 2014 at 8:08 PM, Marc Delisle <marc@infomarc.info> wrote:
Le 2014-07-24 06:01, Ashutosh Dhundhara a écrit :
> On Thu, Jul 24, 2014 at 5:32 PM, Marc Delisle <marc@infomarc.info
> <mailto:marc@infomarc.info>> wrote:
>
>     Le 2014-07-23 22:39, Hugues Peccatte a écrit :
>     > 2014-07-23 20:22 GMT+02:00 Ashutosh Dhundhara
>     > <ashutoshdhundhara@yahoo.com <mailto:ashutoshdhundhara@yahoo.com>
>     <mailto:ashutoshdhundhara@yahoo.com
>     <mailto:ashutoshdhundhara@yahoo.com>>>:
>     >
>     >     Hi,
>     >
>     >     This is in regards with RFE #919
>     >     <http://sourceforge.net/p/phpmyadmin/feature-requests/919/>
>     (Multiple-column
>     >     foreign key relation). I was trying to figure out the UI for
>     this by
>     >     modifying the existing one. I have attached a screenshot for
>     the same.
>     >     Please comment.
>     >
>     >     --
>     >     Ashutosh Dhundhara
>     >
>     >
>     > Hi,
>     >
>     > This is nice.
>     > IMO the constraint name should be displayed as a title, and not
>     > displayed in the bottom-right corner, so you will see it easily.
>     > Maybe, you can reduce table rows height, by displaying the ON
>     UPDATE and
>     > DELETE on the same line.
>     >
>     > Hugues.
>
>     Hi Ashutosh,
>     somehow I missed your initial email but saw the screenshot in the
>     archives.
>
>     The UI you are proposing does not work, in my opinion. On the left side,
>     you are proposing multiple columns, but the feature request is about
>     having, on the left side, one column, and on the foreign key constraint
>     side (right), multiple columns.
>
>
> Hi Marc,
>
> can you please quote an example of this case?
>
> Are you talking about a case like this:
>
> Lets say I have two tables `table_1` and `table_2` with two columns `id`
> and `value`.
> The query:
> ALTER TABLE `table_2` ADD FOREIGN KEY (`id`) REFERENCES `table_1` (`id`,
> `value`);

Hi Ashutosh,
yes, I was thinking about a case like this but I reverified in
http://dev.mysql.com/doc/refman/5.5/en/create-table-foreign-keys.html
and it does not look to be possible.

So your UI is correct, in general, except that I suggest that instead of
numbering the relations (1, 2), you just use some visual divider like a
horizontal line. Numbering would introduce a doubt about the order of
the foreign keys, which does not exist (each FK is independent from the
others).

Yeah, you are right. This looks a bit confusing. I will try some visual divider.
 

I have a few questions about your screenshot:

- Does it represent the case when a user is trying to add constraints to
table_2 ?

Yes. This represents the case when user is trying to add constraints to `table_2`.
 

- Why did the user match table_1.value for the id column, and table_1.id
for the value column? Taking the MySQL manual as an example, it's much
easier to understand this:

FOREIGN KEY (product_category, product_id)
      REFERENCES product(category, id)

 Yes Marc, your example is relevant. I did this because my table structures were as follows:

`table_1`
id      : int
value : varchar

`table_2`
id      : varchar
value : int

Thats why table_2.id is compatible with table_1.id.
I will share another improved UI screenshot soon.

--
Ashutosh Dhundhara