From aeeaecea60b8a3bb2e6f54c41fc9ca7d38f4fd82 Mon Sep 17 00:00:00 2001 From: alex-phillips Date: Fri, 28 Feb 2020 16:24:27 -0500 Subject: [PATCH] Remove item-user relationship since we are refactoring this --- migrations/20200215162452-create-item.js | 13 ------------- models/item.js | 7 ------- models/user.js | 6 ------ 3 files changed, 26 deletions(-) diff --git a/migrations/20200215162452-create-item.js b/migrations/20200215162452-create-item.js index 00c2396..6582cd0 100644 --- a/migrations/20200215162452-create-item.js +++ b/migrations/20200215162452-create-item.js @@ -8,15 +8,6 @@ module.exports = { primaryKey: true, type: Sequelize.INTEGER }, - user_id: { - type: Sequelize.INTEGER, - allowNull: false, - references: { - model: 'users', - key: 'id' - }, - onDelete: 'CASCADE' - }, title: { type: Sequelize.STRING, allowNull: false @@ -34,10 +25,6 @@ module.exports = { description: { type: Sequelize.STRING }, - active: { - type: Sequelize.BOOLEAN, - defaultValue: false - }, order: { type: Sequelize.INTEGER, defaultValue: 0 diff --git a/models/item.js b/models/item.js index ca534b1..3fec412 100644 --- a/models/item.js +++ b/models/item.js @@ -5,9 +5,6 @@ const { Model } = require('sequelize') class Item extends Model { static init (sequelize, DataTypes) { return super.init({ - userId: { - type: DataTypes.INTEGER - }, title: { type: DataTypes.STRING, allowNull: false @@ -19,10 +16,6 @@ class Item extends Model { allowNull: false }, description: DataTypes.STRING, - active: { - type: DataTypes.BOOLEAN, - default: false - }, order: { type: DataTypes.INTEGER, default: 0 diff --git a/models/user.js b/models/user.js index 1d63792..5e4bb5a 100644 --- a/models/user.js +++ b/models/user.js @@ -30,12 +30,6 @@ class User extends Model { }) } - static associate (models) { - this.hasMany(models.Item, { - foreignKey: 'user_id' - }) - } - static get ADMIN () { return ADMIN }