<div dir="ltr"><br><br>On Tuesday, July 8, 2014, Marc Delisle <<a href="mailto:marc@infomarc.info" target="_blank">marc@infomarc.info</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Le 2014-07-08 13:33, Ashutosh Dhundhara a écrit :<br>
> On Tue, Jul 8, 2014 at 9:04 PM, Marc Delisle <<a>marc@infomarc.info</a><br>
> <mailto:<a>marc@infomarc.info</a>>> wrote:<br>
><br>
>     Le 2014-07-08 10:48, Ashutosh Dhundhara a écrit :<br>
>     > On Tue, Jul 8, 2014 at 6:01 PM, Marc Delisle <<a>marc@infomarc.info</a><br>
>     <mailto:<a>marc@infomarc.info</a>><br>
>     > <mailto:<a>marc@infomarc.info</a> <mailto:<a>marc@infomarc.info</a>>>> wrote:<br>

>     ><br>
>     >     Le 2014-07-08 07:52, Ashutosh Dhundhara a écrit :<br>
>     >     > Hi,<br>
>     >     ><br>
>     >     > I have got some ideas regarding RFE #908<br>
>     >     > <<a href="http://sourceforge.net/p/phpmyadmin/feature-requests/908/" target="_blank">http://sourceforge.net/p/phpmyadmin/feature-requests/908/</a>><br>
>     >     (Improvements for<br>
>     >     > the table editor (index creation)).<br>
>     >     ><br>
>     >     > *_1. Making Column section on 'Add Index' dialog sort-able._*<br>
>     >     > With this user will be able to change the order of columns<br>
>     in case of<br>
>     >     > composite keys.<br>
>     >     ><br>
>     >     > *_2. Displaying a dialog box when multiple columns for same<br>
>     type of<br>
>     >     > index are selected on 'Create table' page._*<br>
>     >     > This dialog will have two options: 'Create new' and 'Create<br>
>     >     composite'.<br>
>     >     > - 'Create new' will allow user to create a new single column<br>
>     key.<br>
>     >     (Table<br>
>     >     > can have only one Primary key)<br>
>     >     > - 'Create composite' will allow user to add that column to a<br>
>     existing<br>
>     >     > key (to be created) and sort the order of columns.<br>
>     >     ><br>
>     >     > Will this implement this feature request?<br>
>     ><br>
>     >     Hi Ashutosh,<br>
>     >     first, the feature request says "If I add two indexed fields to a<br>
>     >     table"; remember that this action can be done on initial table<br>
>     creation,<br>
>     >     and when adding columns on an existing table.<br>
>     ><br>
>     ><br>
>     > Thanks for pointing this out. I missed that 'adding column on an<br>
>     > existing table' part.<br>
>     ><br>
>     ><br>
>     ><br>
>     >     About your suggestion #1, are you talking about the dialog<br>
>     that appears<br>
>     >     after choosing table Structure > Indexes > Create an index on<br>
>     x columns<br>
>     >     ? If so, the user can already choose the columns in the<br>
>     correct order;<br>
>     >     so you want to help the user change his mind when creating the<br>
>     index?<br>
>     ><br>
>     >     I am not against, but this would be more useful when _editing_<br>
>     an index.<br>
>     >     Or it can be done in both situations.<br>
>     ><br>
>     ><br>
>     ><br>
>     > Yeah, this can be done with the existing system. I failed to see that.<br>
><br>
>     I mean, calling the existing index editor (improved with the sortable<br>
>     columns), when adding the columns with an index choice selected.<br>
><br>
><br>
> But the user can still change the order of columns using the select<br>
> lists on the 'Edit Index' dialog.<br>
<br>
Correct, or by dragging them (this is what you meant by "sortable", right?)</blockquote><div><br></div><div>Yeah, I meant by dragging with the use of existing jQuery UI Sortable plugin.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
><br>
><br>
>     ><br>
>     ><br>
>     >     About your suggestion #2, if the user chose PRIMARY in the<br>
>     selector for<br>
>     >     two columns, it makes no sense to show this additional dialog<br>
>     (unless<br>
>     >     you want him to confirm that the PRIMARY will be composite)<br>
>     but it makes<br>
>     >     sense to allow column sorting.<br>
>     ><br>
>     ><br>
>     > Yeah Marc, I won't show this dialog for PRIMARY key.<br>
><br>
>     But if the user wants to create a composite primary key, I expect that<br>
>     you will show the dialog for choosing the index order.<br>
><br>
><br>
> Yeah, I will do that.<br>
><br>
><br>
>     ><br>
>     ><br>
>     ><br>
>     >     If he chose UNIQUE or INDEX, instead of "Create new" I would<br>
>     say "Create<br>
>     >     single-column indexes". The other message could be "Create a<br>
>     composite<br>
>     >     index" but do you suggest that this choice opens the<br>
>     already-existing<br>
>     >     Edit index dialog, which you would prefill with the chosen<br>
>     column names?<br>
>     ><br>
>     >     As per the feature request, the default choice should be to create<br>
>     >     single-column indexes.<br>
>     ><br>
>     ><br>
>     > I think you are getting it wrong. This part is for 'Create table' page<br>
>     > and 'add column to existing table' page. Lets say I am creating a new<br>
>     > table. I have added a column `col1` and selected UNIQUE index for it<br>
>     > (before clicking 'Go'). I won't see any dialog yet. Now lets I have<br>
>     > added another column `col2` and selected UNIQUE index for this as<br>
>     well.<br>
>     > Now I will get a dialog asking for "Create single-column indexes" or<br>
>     > "Create a composite index". If I will choose "Create a composite<br>
>     index",<br>
>     > then I will get a list of all temporary UNIQUE indexes and I can merge<br>
>     > that column into any of these indexes.<br>
>     > For PRIMARY index, we will need only the composite-index part.<br>
><br>
>     But the create table form can still change before submission. What<br>
>     happens if the user goes back to col1 and unselects UNIQUE?<br>
><br>
><br>
> We can remove that column from the corresponding indexes and add it a<br>
> new as before.<br>
<br>
Yes, but the logic will be more complex. Maybe it would be better to<br>
show a series of dialogs at the end when user submits the form?</blockquote><div><br></div><div>Can you please elaborate a little this series of dialogs part?<br>I am going to temporarily hold this keys and their order information in JS variables. So nothing is committed yet. Its just a simple manipulation of JS variables only.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

><br>
><br>
><br>
>     ><br>
>     > I think this will also handle the issue highlighted by you in the<br>
>     next mail?<br>
><br>
>     Not sure, it depends on the moment when the user uses the index selector<br>
>     and for which column.<br>
><br>
><br>
> Lets user first selects INDEX for col a (no dialog box yet); then<br>
> selects INDEX for col b too and he gets a dialog box. Then he adds col b<br>
> with col a's index by choosing "Create a composite index" option. And<br>
> finally he selects UNIQUE for col c and again he gets a dialog box. Then<br>
> he chooses "Create single-column indexes" option. In this way he can get<br>
> composite-index for a + b and single index on c. Is this the case you<br>
> are referring?<br>
<br>
This case would work, but how can you detect if the user wants to create<br>
a composite on cols A + C and another composite on cols B + D?<br></blockquote><div><br></div><div>The user will get a list all temporarily created indexes when he will choose "Create a composite index" option. For instance, in this case lets say the user has newly added columns A,B,C and D and he has already created composite index A+C and single-column index B. Now when he will choose for composite INDEX for D, he will be asked:</div>
<div><br></div><div>Add this column to which of the following indexes:</div><div><radio_button>  A+C</div><div><radio_button>  B</div><div><br></div><div>After choosing the combination, he will choose the order of the columns. And as I have mentioned above, I will be holding this information in JS variables. Nothing is committed yet.</div>
<div><br></div><div>--</div><div>Ashutosh Dhundhara</div>
</div>