Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ sequelize migration:create --name update-notes
- 'use strict';
- module.exports = {
- up: (queryInterface, Sequelize) => {
- return queryInterface.addColumn(
- 'Notes',
- 'title',
- Sequelize.STRING
- );
- },
- down: (queryInterface, Sequelize) => {
- return queryInterface.removeColumn(
- 'Notes',
- 'title'
- );
- }
- };
- $ sequelize db:migrate
- 'use strict';
- // models/notes.js
- module.exports = (sequelize, DataTypes) => {
- const Notes = sequelize.define('Notes', {
- content: DataTypes.TEXT // NO 'TITLE' COLUMN
- }, {});
- Notes.associate = function(models) {
- // associations can be defined here
- };
- return Notes;
- };
Add Comment
Please, Sign In to add comment