Creating Band schema

Let's create the schema that will store in the database the data of each band that the user creates in the system.

  1. Open terminal/shell and type the following command:
          sequelize model:create --name Band --attributes "name:string,
           description:string, album:string, year:string, UserId:integer"
    
  2. As in the previous step, two files were created, one for migration of data and another to be used as a Band model, as the following code:
     'use strict'; module.exports = function(sequelize, DataTypes) { var Band = sequelize.define('Band', { name: DataTypes.STRING, description: DataTypes.STRING, album: DataTypes.STRING, year: DataTypes.STRING, UserId: DataTypes.INTEGER }, { classMethods: { associate: function(models) { // associations can ...

Get Node.js 6.x Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.