On Tuesday, July 8, 2014, Marc Delisle <marc@infomarc.info> wrote:
Le 2014-07-08 13:33, Ashutosh Dhundhara a écrit :
> On Tue, Jul 8, 2014 at 9:04 PM, Marc Delisle <marc@infomarc.info
> <mailto:marc@infomarc.info>> wrote:
>
> Le 2014-07-08 10:48, Ashutosh Dhundhara a écrit :
> > On Tue, Jul 8, 2014 at 6:01 PM, Marc Delisle <marc@infomarc.info
> <mailto:marc@infomarc.info>
> > <mailto:marc@infomarc.info <mailto:marc@infomarc.info>>> wrote:
> >
> > Le 2014-07-08 07:52, Ashutosh Dhundhara a écrit :
> > > Hi,
> > >
> > > I have got some ideas regarding RFE #908
> > > <http://sourceforge.net/p/phpmyadmin/feature-requests/908/>
> > (Improvements for
> > > the table editor (index creation)).
> > >
> > > *_1. Making Column section on 'Add Index' dialog sort-able._*
> > > With this user will be able to change the order of columns
> in case of
> > > composite keys.
> > >
> > > *_2. Displaying a dialog box when multiple columns for same
> type of
> > > index are selected on 'Create table' page._*
> > > This dialog will have two options: 'Create new' and 'Create
> > composite'.
> > > - 'Create new' will allow user to create a new single column
> key.
> > (Table
> > > can have only one Primary key)
> > > - 'Create composite' will allow user to add that column to a
> existing
> > > key (to be created) and sort the order of columns.
> > >
> > > Will this implement this feature request?
> >
> > Hi Ashutosh,
> > first, the feature request says "If I add two indexed fields to a
> > table"; remember that this action can be done on initial table
> creation,
> > and when adding columns on an existing table.
> >
> >
> > Thanks for pointing this out. I missed that 'adding column on an
> > existing table' part.
> >
> >
> >
> > About your suggestion #1, are you talking about the dialog
> that appears
> > after choosing table Structure > Indexes > Create an index on
> x columns
> > ? If so, the user can already choose the columns in the
> correct order;
> > so you want to help the user change his mind when creating the
> index?
> >
> > I am not against, but this would be more useful when _editing_
> an index.
> > Or it can be done in both situations.
> >
> >
> >
> > Yeah, this can be done with the existing system. I failed to see that.
>
> I mean, calling the existing index editor (improved with the sortable
> columns), when adding the columns with an index choice selected.
>
>
> But the user can still change the order of columns using the select
> lists on the 'Edit Index' dialog.
Correct, or by dragging them (this is what you meant by "sortable", right?)
Yeah, I meant by dragging with the use of existing jQuery UI Sortable plugin.
>
>
> >
> >
> > About your suggestion #2, if the user chose PRIMARY in the
> selector for
> > two columns, it makes no sense to show this additional dialog
> (unless
> > you want him to confirm that the PRIMARY will be composite)
> but it makes
> > sense to allow column sorting.
> >
> >
> > Yeah Marc, I won't show this dialog for PRIMARY key.
>
> But if the user wants to create a composite primary key, I expect that
> you will show the dialog for choosing the index order.
>
>
> Yeah, I will do that.
>
>
> >
> >
> >
> > If he chose UNIQUE or INDEX, instead of "Create new" I would
> say "Create
> > single-column indexes". The other message could be "Create a
> composite
> > index" but do you suggest that this choice opens the
> already-existing
> > Edit index dialog, which you would prefill with the chosen
> column names?
> >
> > As per the feature request, the default choice should be to create
> > single-column indexes.
> >
> >
> > I think you are getting it wrong. This part is for 'Create table' page
> > and 'add column to existing table' page. Lets say I am creating a new
> > table. I have added a column `col1` and selected UNIQUE index for it
> > (before clicking 'Go'). I won't see any dialog yet. Now lets I have
> > added another column `col2` and selected UNIQUE index for this as
> well.
> > Now I will get a dialog asking for "Create single-column indexes" or
> > "Create a composite index". If I will choose "Create a composite
> index",
> > then I will get a list of all temporary UNIQUE indexes and I can merge
> > that column into any of these indexes.
> > For PRIMARY index, we will need only the composite-index part.
>
> But the create table form can still change before submission. What
> happens if the user goes back to col1 and unselects UNIQUE?
>
>
> We can remove that column from the corresponding indexes and add it a
> new as before.
Yes, but the logic will be more complex. Maybe it would be better to
show a series of dialogs at the end when user submits the form?
Can you please elaborate a little this series of dialogs part?
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.
>
>
>
> >
> > I think this will also handle the issue highlighted by you in the
> next mail?
>
> Not sure, it depends on the moment when the user uses the index selector
> and for which column.
>
>
> Lets user first selects INDEX for col a (no dialog box yet); then
> selects INDEX for col b too and he gets a dialog box. Then he adds col b
> with col a's index by choosing "Create a composite index" option. And
> finally he selects UNIQUE for col c and again he gets a dialog box. Then
> he chooses "Create single-column indexes" option. In this way he can get
> composite-index for a + b and single index on c. Is this the case you
> are referring?
This case would work, but how can you detect if the user wants to create
a composite on cols A + C and another composite on cols B + D?
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:
Add this column to which of the following indexes:
<radio_button> A+C
<radio_button> B
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.
--
Ashutosh Dhundhara