Skip to Content
author's profile photo Former Member
Former Member

reverse engineering of MySQL ignores unique index clauses

I'm trying to reverse engineer my mysql DB, and I'm stuck on the unique index productions.

The script I'm using is correct as I'm currently using it in my production environment.

My original script had this syntax:

create table ACL {

id varchar(255) not null,

acl_id varchar(255) not null,

priority integer not null,

unique (acl_id, priority)

};

This created a column named 'unique' of type '(acl_id, priority)'. Scratch that.

If I use this alter table syntax, the statement is silently ignored: (No indication on the console tab it was dropped)

alter table ACL

add unique index xxxx (acl_id, priority);

The UNIQUE keyword seems to be the troublesome bit here. This statement is accepted:

alter table ACL_ENTRY

add index xxxx (acl_id, priority);

Thanks for any pointers.

-Evan-

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 06, 2014 at 02:28 PM


    Hi Evan,

    as far as I know only outer create index statements are supported with the MySQL xdbs.

    So you have to use two statments like

    create table ACL
    (
    id varchar(255) not null,
    acl_id varchar(255) not null,
    priority integer not null
    );

    create unique index xxxx on ACL
    (
    acl_id,
    priority
    );

    Regarding the reverse of the unique index it seems to be an issue inside the xdb.

    If i look at MYSQL50.XDB under Script\Objects\Index\Create I see

    [.O:[create [%UNIQUE% ][%FullText%?fulltext ]index %INDEX% on [%QUALIFIER%]%TABLE%

    (

    %CIDXLIST%

    )][alter table [%QUALIFIER%]%TABLE% add index %INDEX%

    (

    %CIDXLIST%

    )]]

    seems the [%UNIQUE% ] for alter is not supportet as well.

    If I modify this to

    ....

    )][alter table [%QUALIFIER%]%TABLE% add [%UNIQUE% ] index %INDEX%

    ....

    I was able to reverse the unique index.

    best regards

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.