refactor(backend): consolidate all prisma seeders into single master seed.ts entrypoint
This commit is contained in:
parent
0d805b0eb9
commit
1340a2be87
@ -88,6 +88,6 @@
|
||||
"testEnvironment": "node"
|
||||
},
|
||||
"prisma": {
|
||||
"seed": "ts-node prisma/seed.ts && ts-node prisma/seed-products.ts && ts-node prisma/seed-home.ts"
|
||||
"seed": "ts-node prisma/seed.ts"
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,7 +255,10 @@ async function main() {
|
||||
|
||||
// 2. Seed Scientific Terms
|
||||
console.log('Seeding Scientific Terms...');
|
||||
const termsFilePath = path.join(process.cwd() + "/prisma", '..', '..', 'frontend', 'application', 'lib', 'data', 'scientificTerms.ts');
|
||||
let termsFilePath = path.join(process.cwd() + "/prisma", '..', '..', 'frontend', 'application', 'lib', 'data', 'scientificTerms.ts');
|
||||
if (!fs.existsSync(termsFilePath)) {
|
||||
termsFilePath = path.join(process.cwd(), 'prisma', 'scientificTerms.ts');
|
||||
}
|
||||
if (fs.existsSync(termsFilePath)) {
|
||||
const termsContent = fs.readFileSync(termsFilePath, 'utf-8');
|
||||
const termsJsCode = ts.transpile(termsContent, {
|
||||
@ -290,7 +293,25 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Seeding completed successfully!');
|
||||
// 3. Seed Products & Categories
|
||||
console.log('Seeding Products & Categories...');
|
||||
try {
|
||||
const { main: seedProducts } = await import('./seed-products');
|
||||
await seedProducts();
|
||||
} catch (err) {
|
||||
console.error('Failed to seed products:', err);
|
||||
}
|
||||
|
||||
// 4. Seed Home Components & Testimonials
|
||||
console.log('Seeding Home Components...');
|
||||
try {
|
||||
const { main: seedHome } = await import('./seed-home');
|
||||
await seedHome();
|
||||
} catch (err) {
|
||||
console.error('Failed to seed home components:', err);
|
||||
}
|
||||
|
||||
console.log('All Seeding completed successfully!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user