x
This commit is contained in:
1 parent
c23a4723ed
commit
07e9413a6b
13 files changed
+497
-94
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import prisma from './src/lib/prisma';
|
||||
|
||||
async function main() {
|
||||
console.log('Starting deletion process...');
|
||||
|
||||
try {
|
||||
// Delete all product variants first to avoid foreign key constraint errors
|
||||
const deletedVariants = await prisma.productVariant.deleteMany({});
|
||||
console.log(`Deleted ${deletedVariants.count} ProductVariants.`);
|
||||
|
||||
// Delete all products
|
||||
const deletedProducts = await prisma.product.deleteMany({});
|
||||
console.log(`Deleted ${deletedProducts.count} Products.`);
|
||||
|
||||
console.log('Deletion completed successfully.');
|
||||
} catch (error) {
|
||||
console.error('Error deleting products:', error);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in new issue
Block a user