316 lines
5.2 KiB
JavaScript
316 lines
5.2 KiB
JavaScript
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
const DisasterActivities = db.disaster_activities;
|
|
|
|
const Donations = db.donations;
|
|
|
|
const Emergencies = db.emergencies;
|
|
|
|
const Seminars = db.seminars;
|
|
|
|
const Shelters = db.shelters;
|
|
|
|
const Volunteers = db.volunteers;
|
|
|
|
const DisasterActivitiesData = [
|
|
{
|
|
activity_name: 'Flood Relief Operations',
|
|
|
|
activity_date: new Date('2023-09-15T08:00:00Z'),
|
|
|
|
location: 'Springfield',
|
|
},
|
|
|
|
{
|
|
activity_name: 'Earthquake Drill',
|
|
|
|
activity_date: new Date('2023-09-20T10:00:00Z'),
|
|
|
|
location: 'Metropolis',
|
|
},
|
|
|
|
{
|
|
activity_name: 'Wildfire Evacuation',
|
|
|
|
activity_date: new Date('2023-09-25T14:00:00Z'),
|
|
|
|
location: 'Gotham',
|
|
},
|
|
|
|
{
|
|
activity_name: 'Hurricane Preparedness',
|
|
|
|
activity_date: new Date('2023-09-30T09:00:00Z'),
|
|
|
|
location: 'Star City',
|
|
},
|
|
|
|
{
|
|
activity_name: 'Tsunami Awareness',
|
|
|
|
activity_date: new Date('2023-10-05T11:00:00Z'),
|
|
|
|
location: 'Central City',
|
|
},
|
|
];
|
|
|
|
const DonationsData = [
|
|
{
|
|
donor_name: 'John Doe',
|
|
|
|
amount: 100.5,
|
|
|
|
donation_date: new Date('2023-10-01T10:00:00Z'),
|
|
},
|
|
|
|
{
|
|
donor_name: 'Jane Smith',
|
|
|
|
amount: 250.75,
|
|
|
|
donation_date: new Date('2023-10-02T11:30:00Z'),
|
|
},
|
|
|
|
{
|
|
donor_name: 'Acme Corp',
|
|
|
|
amount: 5000,
|
|
|
|
donation_date: new Date('2023-10-03T14:45:00Z'),
|
|
},
|
|
|
|
{
|
|
donor_name: 'Global Aid',
|
|
|
|
amount: 750,
|
|
|
|
donation_date: new Date('2023-10-04T09:15:00Z'),
|
|
},
|
|
|
|
{
|
|
donor_name: 'Anonymous',
|
|
|
|
amount: 50,
|
|
|
|
donation_date: new Date('2023-10-05T16:00:00Z'),
|
|
},
|
|
];
|
|
|
|
const EmergenciesData = [
|
|
{
|
|
type: 'Police',
|
|
|
|
contact_number: '911',
|
|
},
|
|
|
|
{
|
|
type: 'Ambulance',
|
|
|
|
contact_number: '112',
|
|
},
|
|
|
|
{
|
|
type: 'Fire Department',
|
|
|
|
contact_number: '101',
|
|
},
|
|
|
|
{
|
|
type: 'Coast Guard',
|
|
|
|
contact_number: '999',
|
|
},
|
|
|
|
{
|
|
type: 'Disaster Management',
|
|
|
|
contact_number: '108',
|
|
},
|
|
];
|
|
|
|
const SeminarsData = [
|
|
{
|
|
title: 'Disaster Preparedness 101',
|
|
|
|
start_date: new Date('2023-11-01T09:00:00Z'),
|
|
|
|
end_date: new Date('2023-11-01T12:00:00Z'),
|
|
|
|
location: 'Community Hall, Springfield',
|
|
},
|
|
|
|
{
|
|
title: 'Emergency Response Training',
|
|
|
|
start_date: new Date('2023-11-05T13:00:00Z'),
|
|
|
|
end_date: new Date('2023-11-05T16:00:00Z'),
|
|
|
|
location: 'City Center, Metropolis',
|
|
},
|
|
|
|
{
|
|
title: 'First Aid Basics',
|
|
|
|
start_date: new Date('2023-11-10T10:00:00Z'),
|
|
|
|
end_date: new Date('2023-11-10T11:30:00Z'),
|
|
|
|
location: 'Health Center, Gotham',
|
|
},
|
|
|
|
{
|
|
title: 'Volunteer Coordination',
|
|
|
|
start_date: new Date('2023-11-15T14:00:00Z'),
|
|
|
|
end_date: new Date('2023-11-15T17:00:00Z'),
|
|
|
|
location: 'Volunteer Hub, Star City',
|
|
},
|
|
|
|
{
|
|
title: 'Crisis Management Strategies',
|
|
|
|
start_date: new Date('2023-11-20T09:30:00Z'),
|
|
|
|
end_date: new Date('2023-11-20T11:30:00Z'),
|
|
|
|
location: 'Conference Room, Central City',
|
|
},
|
|
];
|
|
|
|
const SheltersData = [
|
|
{
|
|
name: 'Green Valley Shelter',
|
|
|
|
address: '123 Green Valley Rd, Springfield',
|
|
|
|
latitude: 37.7749,
|
|
|
|
longitude: -122.4194,
|
|
},
|
|
|
|
{
|
|
name: 'Safe Haven Shelter',
|
|
|
|
address: '456 Safe Haven St, Metropolis',
|
|
|
|
latitude: 34.0522,
|
|
|
|
longitude: -118.2437,
|
|
},
|
|
|
|
{
|
|
name: 'Harbor Light Shelter',
|
|
|
|
address: '789 Harbor Light Ave, Gotham',
|
|
|
|
latitude: 40.7128,
|
|
|
|
longitude: -74.006,
|
|
},
|
|
|
|
{
|
|
name: 'Sunrise Shelter',
|
|
|
|
address: '101 Sunrise Blvd, Star City',
|
|
|
|
latitude: 41.8781,
|
|
|
|
longitude: -87.6298,
|
|
},
|
|
|
|
{
|
|
name: 'Hope Center',
|
|
|
|
address: '202 Hope St, Central City',
|
|
|
|
latitude: 34.0522,
|
|
|
|
longitude: -118.2437,
|
|
},
|
|
];
|
|
|
|
const VolunteersData = [
|
|
{
|
|
name: 'Alice Johnson',
|
|
|
|
contact_info: 'alice.johnson@example.com',
|
|
|
|
// type code here for "relation_many" field
|
|
},
|
|
|
|
{
|
|
name: 'Bob Williams',
|
|
|
|
contact_info: 'bob.williams@example.com',
|
|
|
|
// type code here for "relation_many" field
|
|
},
|
|
|
|
{
|
|
name: 'Charlie Brown',
|
|
|
|
contact_info: 'charlie.brown@example.com',
|
|
|
|
// type code here for "relation_many" field
|
|
},
|
|
|
|
{
|
|
name: 'Diana Prince',
|
|
|
|
contact_info: 'diana.prince@example.com',
|
|
|
|
// type code here for "relation_many" field
|
|
},
|
|
|
|
{
|
|
name: 'Eve Adams',
|
|
|
|
contact_info: 'eve.adams@example.com',
|
|
|
|
// type code here for "relation_many" field
|
|
},
|
|
];
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
await DisasterActivities.bulkCreate(DisasterActivitiesData);
|
|
|
|
await Donations.bulkCreate(DonationsData);
|
|
|
|
await Emergencies.bulkCreate(EmergenciesData);
|
|
|
|
await Seminars.bulkCreate(SeminarsData);
|
|
|
|
await Shelters.bulkCreate(SheltersData);
|
|
|
|
await Volunteers.bulkCreate(VolunteersData);
|
|
|
|
await Promise.all([
|
|
// Similar logic for "relation_many"
|
|
// Similar logic for "relation_many"
|
|
]);
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.bulkDelete('disaster_activities', null, {});
|
|
|
|
await queryInterface.bulkDelete('donations', null, {});
|
|
|
|
await queryInterface.bulkDelete('emergencies', null, {});
|
|
|
|
await queryInterface.bulkDelete('seminars', null, {});
|
|
|
|
await queryInterface.bulkDelete('shelters', null, {});
|
|
|
|
await queryInterface.bulkDelete('volunteers', null, {});
|
|
},
|
|
};
|