You can and should use sequelize for your migrations if you're using sequelize in your application. The library has great documentation for handling migrations.
In terms of adding columns with sequelize, you first create a migration through the command line. Run sequelize -c migration-name
. An example can be: sequelize -c add_location_to_users
.
Once you run this command, you'll find a migration file in your root directory migrations folder. That is where you describe what the migration should change in your database. To keep with the example, here is a sample method.
migration.addColumn(
'Users',
'Location',
DataTypes.STRING
)
Running this migration will add the column 'Location' with the datatype string to the 'User' table.
http://sequelizejs.com/docs/latest/migrations#functions This link will take you to other functions you have available with sequelize, which include changing the column, renaming the column, renaming the table, etc.
In terms of adding entries to your table, sequelize gives you the option to run create or findOrCreate on the model. Here is an example with the user table.
User.create({ name: 'foo', email: 'bar', location: 'New York' }).success(function(user) {
console.log(user.location); //this prints the users location
})
You then have access to user (the created entry in the database) in the callback in success(), where I printed the new users location above. The instances section of the documentation is where you will find other methods around dealing with an instance of your classes (or 'entry in the database').