From 9a7853dc8292fa361691c4669bf0219079dc81d3 Mon Sep 17 00:00:00 2001 From: shoaibalmasi Date: Fri, 26 Mar 2021 01:58:28 +0430 Subject: [PATCH] edit model --- migrations/20210325163147-addNewColumn.js | 21 +++++++++++++++++++ .../20210325170616-changeCodeMelliType.js | 15 +++++++++++++ models/user.js | 4 +++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 migrations/20210325163147-addNewColumn.js create mode 100644 migrations/20210325170616-changeCodeMelliType.js diff --git a/migrations/20210325163147-addNewColumn.js b/migrations/20210325163147-addNewColumn.js new file mode 100644 index 0000000..befd9a5 --- /dev/null +++ b/migrations/20210325163147-addNewColumn.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + up: (queryInterface, Sequelize) => { + return Promise.all([ + queryInterface.addColumn('Users', 'healthCenter', { + type: Sequelize.STRING, + allowNull: true, + }), + queryInterface.addColumn('Users', 'healthCenterCity', { + type: Sequelize.STRING, + allowNull: true, + }), + ]); + }, + + down: (queryInterface) => { + return Promise.all([queryInterface.removeColumn('Users', 'healthCenter'), + queryInterface.removeColumn('Users', 'healthCenterCity')]); + }, +}; diff --git a/migrations/20210325170616-changeCodeMelliType.js b/migrations/20210325170616-changeCodeMelliType.js new file mode 100644 index 0000000..e774cbf --- /dev/null +++ b/migrations/20210325170616-changeCodeMelliType.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = { + up: (queryInterface, Sequelize) => { + return Promise.all([ + queryInterface.changeColumn('Users', 'codeMelli', { + type: Sequelize.STRING, + }), + ]); + }, + + down: (queryInterface) => { + return Promise.all([queryInterface.changeColumn('Users', 'codeMelli')]); + }, +}; diff --git a/models/user.js b/models/user.js index 3dbb3f2..95e6324 100644 --- a/models/user.js +++ b/models/user.js @@ -17,7 +17,7 @@ module.exports = (sequelize, DataTypes) => { firstName: DataTypes.STRING, lastName: DataTypes.STRING, fatherName: DataTypes.STRING, - codeMelli: DataTypes.BIGINT, + codeMelli: DataTypes.STRING, workUnit: DataTypes.STRING, workUnitCode: DataTypes.INTEGER, address: DataTypes.TEXT, @@ -28,6 +28,8 @@ module.exports = (sequelize, DataTypes) => { writtenOrderNumber: DataTypes.INTEGER, writtenOrderDate: DataTypes.DATE, deadline: DataTypes.INTEGER, + healthCenter: DataTypes.STRING, + healthCenterCity: DataTypes.STRING, deadlineUnit: { type: DataTypes.STRING, defaultValue: 'روز'