From 9f5c840082a680fee78ddbc5ce44cb0aea259b31 Mon Sep 17 00:00:00 2001 From: John Hopkins Date: Mon, 31 Oct 2016 14:30:28 -0700 Subject: [PATCH] added migration for CompletedItems table --- .../20161031211644-create-completed-items.js | 30 +++++++++++++++++++ models/completeditems.js | 14 +++++++++ 2 files changed, 44 insertions(+) create mode 100644 migrations/20161031211644-create-completed-items.js create mode 100644 models/completeditems.js diff --git a/migrations/20161031211644-create-completed-items.js b/migrations/20161031211644-create-completed-items.js new file mode 100644 index 0000000..f29d8cb --- /dev/null +++ b/migrations/20161031211644-create-completed-items.js @@ -0,0 +1,30 @@ +'use strict'; +module.exports = { + up: function(queryInterface, Sequelize) { + return queryInterface.createTable('CompletedItems', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER + }, + item_id: { + type: Sequelize.INTEGER + }, + completedBy: { + type: Sequelize.INTEGER + }, + createdAt: { + allowNull: false, + type: Sequelize.DATE + }, + updatedAt: { + allowNull: false, + type: Sequelize.DATE + } + }); + }, + down: function(queryInterface, Sequelize) { + return queryInterface.dropTable('CompletedItems'); + } +}; \ No newline at end of file diff --git a/models/completeditems.js b/models/completeditems.js new file mode 100644 index 0000000..6df7b14 --- /dev/null +++ b/models/completeditems.js @@ -0,0 +1,14 @@ +'use strict'; +module.exports = function(sequelize, DataTypes) { + var CompletedItems = sequelize.define('CompletedItems', { + item_id: DataTypes.INTEGER, + completedBy: DataTypes.INTEGER + }, { + classMethods: { + associate: function(models) { + // associations can be defined here + } + } + }); + return CompletedItems; +}; \ No newline at end of file