Many an update!
This commit is contained in:
parent
85195d6c7a
commit
d588c49946
35 changed files with 3528 additions and 1142 deletions
|
|
@ -1,44 +1,47 @@
|
|||
import mongoose from 'mongoose'
|
||||
import { connectDB } from '../server/utils/mongoose.js'
|
||||
import dotenv from 'dotenv'
|
||||
import mongoose from "mongoose";
|
||||
import { connectDB } from "../server/utils/mongoose.js";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
// Load environment variables
|
||||
dotenv.config()
|
||||
dotenv.config();
|
||||
|
||||
// Import seed functions
|
||||
import { execSync } from 'child_process'
|
||||
import { execSync } from "child_process";
|
||||
|
||||
async function seedAll() {
|
||||
try {
|
||||
console.log('🌱 Starting database seeding...\n')
|
||||
|
||||
console.log("🌱 Starting database seeding...\n");
|
||||
|
||||
// Seed members
|
||||
console.log('👥 Seeding members...')
|
||||
execSync('node scripts/seed-members.js', { stdio: 'inherit' })
|
||||
|
||||
console.log('\n🎉 Seeding events...')
|
||||
execSync('node scripts/seed-events.js', { stdio: 'inherit' })
|
||||
|
||||
console.log('\n✅ All data seeded successfully!')
|
||||
console.log('\n📊 Database Summary:')
|
||||
|
||||
console.log("👥 Seeding members...");
|
||||
execSync("node scripts/seed-members.js", { stdio: "inherit" });
|
||||
|
||||
console.log("\n🎉 Seeding events...");
|
||||
execSync("node scripts/seed-events.js", { stdio: "inherit" });
|
||||
|
||||
console.log("\n📅 Seeding series events...");
|
||||
execSync("node scripts/seed-series-events.js", { stdio: "inherit" });
|
||||
|
||||
console.log("\n✅ All data seeded successfully!");
|
||||
console.log("\n📊 Database Summary:");
|
||||
|
||||
// Connect and show final counts
|
||||
await connectDB()
|
||||
|
||||
const Member = (await import('../server/models/member.js')).default
|
||||
const Event = (await import('../server/models/event.js')).default
|
||||
|
||||
const memberCount = await Member.countDocuments()
|
||||
const eventCount = await Event.countDocuments()
|
||||
|
||||
console.log(` Members: ${memberCount}`)
|
||||
console.log(` Events: ${eventCount}`)
|
||||
|
||||
process.exit(0)
|
||||
await connectDB();
|
||||
|
||||
const Member = (await import("../server/models/member.js")).default;
|
||||
const Event = (await import("../server/models/event.js")).default;
|
||||
|
||||
const memberCount = await Member.countDocuments();
|
||||
const eventCount = await Event.countDocuments();
|
||||
|
||||
console.log(` Members: ${memberCount}`);
|
||||
console.log(` Events: ${eventCount}`);
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('❌ Error seeding database:', error)
|
||||
process.exit(1)
|
||||
console.error("❌ Error seeding database:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
seedAll()
|
||||
seedAll();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue