Skip to content

Conversation

@hfwittmann
Copy link

For the model given below the index for "testcolumn" is not created when using the current master. This is due to a resulting conflict in l 249 mysql, because the unique property alreadys exists in the table); This is avoided by the proposed change.

/**

  • Define User Model

  • @param {Object} schema

  • @return {Object}
    **/
    module.exports = function (schema) {

    const user = schema.define('user', {
    active : { type : schema.Number },
    username : { type : schema.String, unique : true },
    email : { type : schema.String, unique :true },
    password : { type : schema.String},
    note : { type : schema.Text },
    testcolumn : { type : schema.Date, index:true }
    },{

    // primaryKeys:["email"] // fails
    

    });

    user.validatesPresenceOf('username', 'email', 'password');

    // additional methods and validation here

    return user;
    };

For the following model the index for "testcolumn" is not created for the current master (due to a resulting conflict in l 249 mysql, because the unique property already exists in the table); This is avoided by the proposed change.

/**
 *  Define User Model
 *  @param {Object} schema
 *  @return {Object}
 **/
module.exports = function (schema) {

    const user = schema.define('user', {
           active : { type : schema.Number },
           username : { type : schema.String, unique : true },
           email : { type : schema.String, unique :true },
           password : { type : schema.String},
           note : { type : schema.Text },
           testcolumn : { type : schema.Date, index:true  }
    },{

        // primaryKeys:["email"] // fails
    });


    user.validatesPresenceOf('username', 'email', 'password');

    // additional methods and validation here

    return user;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant