Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

adding indexing on a db model in mysql using sequelize

module.exports = (sequelize, DataTypes) => {
    const Item = sequelize.define('Item', {
        itemId:  DataTypes.STRING,
        ownerId:  DataTypes.INTEGER,
        status: DataTypes.STRING,
        type: DataTypes.STRING,
        nature: DataTypes.STRING,
        content: DataTypes.STRING,
        moment: DataTypes.BIGINT
    },
    {
      indexes:[
       {
         unique: false,
         fields:['ownerId']
       }
      ]
    });

    return Item;
};
 
PREVIOUS NEXT
Tagged: #adding #indexing #db #model #mysql #sequelize
ADD COMMENT
Topic
Name
7+5 =