working changes to use sequelize auto index

This commit is contained in:
Arjun Patel
2019-03-16 22:41:57 -07:00
parent 52c284f02a
commit e5c204890e
26 changed files with 82 additions and 91 deletions
+55
View File
@@ -0,0 +1,55 @@
module.exports = (sequelize, DataTypes) => {
const Donor = sequelize.define('Donor', {
id: {
type: DataTypes.UUID,
allowNull: false,
primaryKey: true
},
stripe_id: {
type: DataTypes.UUID,
defaultValue: null,
unique: true
},
subscription_id: {
type: DataTypes.UUID,
defaultValue: null,
unique: true
},
first_name: {
type: DataTypes.STRING,
allowNull: false
},
last_name: {
type: DataTypes.STRING,
allowNull: false
},
email: {
type: DataTypes.STRING,
validate: {
isEmail: true
},
allowNull: false,
unique: true
},
password: {
type: DataTypes.STRING,
allowNull: false
},
age: DataTypes.INTEGER,
phone: DataTypes.STRING(20),
address: DataTypes.STRING,
city: DataTypes.STRING,
state: DataTypes.STRING,
zip: DataTypes.STRING(10),
country: DataTypes.STRING
});
Donor.associate = models => {
Donor.hasMany(models.Grant, {
foreignKey: 'donor_id'
});
};
return Donor;
};