Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorbadPussycat
     

    Hello Forum,

    I wanna add an Unique Index to my table. I found the following information (for Rails) http://garrettsnider.backpackit.com/pub/367902 and accordingly I add the following Lines to my migration-script

    function up_2()
    {
        $this->addIndex('users','e_mail','unique');
    }
    

    but If I run migrate User install I get an SQL-Error:

    (mysqlt): ALTER TABLE users ADD INDEX unique (e_mail)

    1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unique (e_mail)' at line 1

    AFAIK is the right syntax: ALTER TABLE users ADD UNIQUE (e_mail)

    how do I achieve this?

    thanks for the great work! I love Akelos! :-)

    greetings from germany badPussycat

    • CommentAuthorKaste
     

    in Akelos it should be

     addIndex('users','e_mail UNIQUE');
    

    the third argument takes the optional index-name.