database changes and initial causes and regions
This commit is contained in:
@@ -5,7 +5,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
name: { type: DataTypes.STRING, allowNull: false }
|
||||
name: { type: DataTypes.STRING, allowNull: false, unique: true }
|
||||
});
|
||||
return Cause;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const uuidv4 = require('uuid/v4');
|
||||
const uuidv4 = require('uuid/v4'),
|
||||
Cause = require('./cause.model'),
|
||||
Region = require('./region.model');
|
||||
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const Organization = sequelize.define('organizations', {
|
||||
@@ -45,21 +47,35 @@ module.exports = (sequelize, DataTypes) => {
|
||||
allowNull: false
|
||||
},
|
||||
|
||||
primary_cause: { type: DataTypes.STRING, allowNull: false },
|
||||
primary_region: { type: DataTypes.STRING, allowNull: false },
|
||||
primary_cause: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: Cause(sequelize, DataTypes),
|
||||
key: 'name'
|
||||
}
|
||||
},
|
||||
primary_region: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: Region(sequelize, DataTypes),
|
||||
key: 'name'
|
||||
}
|
||||
},
|
||||
|
||||
total_rating: { type: DataTypes.INTEGER, defaultValue: 0 },
|
||||
|
||||
ein: {
|
||||
type: DataTypes.INTEGER,
|
||||
type: DataTypes.STRING(10),
|
||||
allowNull: false
|
||||
},
|
||||
estimate_assets: {
|
||||
estimate_asset_value: {
|
||||
type: DataTypes.BIGINT,
|
||||
defaultValue: 0
|
||||
},
|
||||
estimate_year_operating_cost: {
|
||||
type: DataTypes.INTEGER,
|
||||
type: DataTypes.BIGINT,
|
||||
defaultValue: 0
|
||||
},
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
name: { type: DataTypes.STRING, allowNull: false }
|
||||
name: { type: DataTypes.STRING, allowNull: false, unique: true }
|
||||
});
|
||||
return Region;
|
||||
};
|
||||
|
||||
@@ -4,12 +4,37 @@ module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkInsert('causes', [
|
||||
{
|
||||
name: 'Animal Care',
|
||||
name: 'Animal',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Water',
|
||||
name: 'Environment',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Health',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Human Services',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Education',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Arts and Culture',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Religion',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
}
|
||||
@@ -17,6 +42,28 @@ module.exports = {
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkDelete('causes', [{ name: 'Water' }, { name: 'Animal Care' }]);
|
||||
return queryInterface.bulkDelete('causes', [
|
||||
{
|
||||
name: 'Animal'
|
||||
},
|
||||
{
|
||||
name: 'Environment'
|
||||
},
|
||||
{
|
||||
name: 'Health'
|
||||
},
|
||||
{
|
||||
name: 'Human Services'
|
||||
},
|
||||
{
|
||||
name: 'Education'
|
||||
},
|
||||
{
|
||||
name: 'Arts and Culture'
|
||||
},
|
||||
{
|
||||
name: 'Religion'
|
||||
}
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,7 +4,57 @@ module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkInsert('regions', [
|
||||
{
|
||||
name: 'North India',
|
||||
name: 'Africa',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'East Asia',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'South Asia',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Central America',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'North America',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'South America',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Eastern Europe',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Western Europe',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Middle East',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Oceania',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: 'Caribbean',
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
}
|
||||
@@ -12,6 +62,40 @@ module.exports = {
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkDelete('regions', { name: 'North India' });
|
||||
return queryInterface.bulkDelete('regions', [
|
||||
{
|
||||
name: 'Africa'
|
||||
},
|
||||
{
|
||||
name: 'East Asia'
|
||||
},
|
||||
{
|
||||
name: 'South Asia'
|
||||
},
|
||||
{
|
||||
name: 'Central America'
|
||||
},
|
||||
{
|
||||
name: 'North America'
|
||||
},
|
||||
{
|
||||
name: 'South America'
|
||||
},
|
||||
{
|
||||
name: 'Eastern Europe'
|
||||
},
|
||||
{
|
||||
name: 'Western Europe'
|
||||
},
|
||||
{
|
||||
name: 'Middle East'
|
||||
},
|
||||
{
|
||||
name: 'Oceania'
|
||||
},
|
||||
{
|
||||
name: 'Caribbean'
|
||||
}
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,13 +18,13 @@ module.exports = {
|
||||
zip: '92604',
|
||||
|
||||
primary_cause: 'Animal',
|
||||
primary_region: '',
|
||||
primary_region: 'North India',
|
||||
|
||||
ein,
|
||||
estimate_assets,
|
||||
estimate_year_operating_cost,
|
||||
ein: '63-6088665',
|
||||
estimate_asset_value: 200000,
|
||||
estimate_yearly_operating_cost: 40000,
|
||||
|
||||
isNonprofit,
|
||||
isNonprofit: true,
|
||||
|
||||
primary_contact_phone,
|
||||
primary_contact_first_name,
|
||||
|
||||
Reference in New Issue
Block a user