Create custom field table and assocs

This commit is contained in:
canove
2020-07-23 17:15:47 -03:00
parent c61ef7e732
commit b20ed4c8db
8 changed files with 134 additions and 5 deletions

View File

@@ -0,0 +1,41 @@
"use strict";
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable("ContactCustomFields", {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
allowNull: false,
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
value: {
type: Sequelize.STRING,
allowNull: false,
},
contactId: {
type: Sequelize.INTEGER,
references: { model: "Contacts", key: "id" },
onUpdate: "CASCADE",
onDelete: "CASCADE",
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
});
},
down: queryInterface => {
return queryInterface.dropTable("ContactCustomFields");
},
};