Skip to content

Instantly share code, notes, and snippets.

@in43sh
Created November 30, 2018 22:24
Show Gist options
  • Save in43sh/fdaeefc3810b599bbf77829825261c25 to your computer and use it in GitHub Desktop.
Save in43sh/fdaeefc3810b599bbf77829825261c25 to your computer and use it in GitHub Desktop.
'use strict';
module.exports = (sequelize, DataTypes) => {
const Properties = sequelize.define('Properties', {
name: {
allowNull: false,
type: DataTypes.STRING
},
address: {
allowNull: false,
type: DataTypes.STRING
},
category: {
allowNull: false,
type: DataTypes.STRING
},
open_time: {
allowNull: false,
type: DataTypes.STRING
},
close_time: {
allowNull: false,
type: DataTypes.STRING
},
description: {
allowNull: false,
type: DataTypes.STRING
},
photo: {
allowNull: false,
type: DataTypes.STRING
},
geoloc: {
allowNull: false,
type: DataTypes.GEOMETRY
}
}, {
timestamps: true,
paranoid: true
});
Properties.associate = function(models) {
// associations can be defined here
Properties.hasMany(models.Deals, {
foreignKey: 'id',
onDelete: 'CASCADE'
})
};
return Properties;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment