text: const sequelize = require('../config/connection');
  const { User, Blogpost } = require('../models');
  
  const userData = require('./userData.json');
  const blogpostData = require('./blogpostData.json');
  
  const seedDatabase = async () => {
    await sequelize.sync({ force: true });
  
    const users = await User.bulkCreate(userData, {
      individualHooks: true,
      returning: true,
    });
  
    const blogposts = await Blogpost.bulkCreate(blogpostData, {
      individualHooks: true,
      returning: true,
    });
  
    // for (const blogpost of blogpostData) {
    //   await Blogpost.create({
    //     ...blogpost,
    //     // Randomize a user_id.
    //     user_id: users[Math.floor(Math.random() * users.length)].id,
    //   });
    // }
  
    process.exit(0);
  };
  
  seedDatabase();
  