/** * {{FeatureName}} Feature Seed Data * @file prisma/seeding/{{featureName}}.seed.js * * Run this seed file individually: * node prisma/seeding/{{featureName}}.seed.js * * Or include in your main seed file: * require('./seeding/{{featureName}}.seed.js'); */ import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient(); export async function seed{{FeatureName}}() { console.log('🌱 Seeding {{featureName}} data...'); try { // Check if {{featureName}} data already exists const existingCount = await prisma.{{tableName}}.count(); if (existingCount > 0) { console.log(`⚠️ {{FeatureName}} table already has ${existingCount} records. Skipping seed...`); return { skipped: true, count: existingCount }; } // Create sample {{featureName}} data const {{featureName}}Data = [ { name: 'Sample {{FeatureName}} 1', }, { name: 'Sample {{FeatureName}} 2', }, { name: 'Sample {{FeatureName}} 3', }, ]; const result = await prisma.{{tableName}}.createMany({ data: {{featureName}}Data }); console.log(`✅ Successfully seeded ${result.count} {{featureName}} records`); return { seeded: true, count: result.count }; } catch (error) { console.error(`❌ Error seeding {{featureName}} data:`, error); throw error; } } // Run directly if this file is executed if (import.meta.url === `file://${process.argv[1]}`) { seed{{FeatureName}}() .then((result) => { console.log('{{FeatureName}} seeding completed:', result); }) .catch((error) => { console.error('{{FeatureName}} seeding failed:', error); process.exit(1); }) .finally(async () => { await prisma.$disconnect(); }); }