11import { PrismaClient } from '@prisma/client' ;
22
3+ const MILLIS_PER_YEAR = 365 * 24 * 60 * 60 * 1000 ;
4+
35const prisma = new PrismaClient ( ) ;
46
57async function main ( ) {
68 console . log ( '🌱 Starting database seed...' ) ;
79
810 // Clear existing data (optional - only if you want fresh data each time)
911 // Uncomment if you want to reset data on each seed
10- // await prisma.testimonial.deleteMany();
1112 // await prisma.payment.deleteMany();
1213 // await prisma.subscription.deleteMany();
1314 // await prisma.account.deleteMany();
@@ -66,7 +67,7 @@ async function main() {
6667 planId : testPlan . id ,
6768 status : 'active' ,
6869 startDate : new Date ( ) ,
69- endDate : new Date ( Date . now ( ) + 365 * 24 * 60 * 60 * 1000 ) , // 1 year from now
70+ endDate : new Date ( Date . now ( ) + MILLIS_PER_YEAR ) , // 1 year from now
7071 autoRenew : true ,
7172 } ,
7273 } )
@@ -76,7 +77,7 @@ async function main() {
7677 planId : testPlan . id ,
7778 status : 'active' ,
7879 startDate : new Date ( ) ,
79- endDate : new Date ( Date . now ( ) + 365 * 24 * 60 * 60 * 1000 ) , // 1 year from now
80+ endDate : new Date ( Date . now ( ) + MILLIS_PER_YEAR ) , // 1 year from now
8081 autoRenew : true ,
8182 } ,
8283 } ) ;
@@ -100,26 +101,6 @@ async function main() {
100101 } ) ;
101102 console . log ( '✅ Created test payment' ) ;
102103
103- // Create test testimonial (if Testimonial model exists)
104- try {
105- const testTestimonial = await ( prisma as any ) . testimonial . upsert ( {
106- where : {
107- userId : premiumUser . id ,
108- } ,
109- update : { } ,
110- create : {
111- userId : premiumUser . id ,
112- name : 'Premium User' ,
113- content : 'Opensox has been amazing! The platform makes managing open source projects so much easier.' ,
114- avatar : 'https://i.pravatar.cc/150?u=premium' ,
115- } ,
116- } ) ;
117- console . log ( '✅ Created test testimonial' ) ;
118- } catch ( error ) {
119- // Testimonial model might not exist in current schema
120- console . log ( '⚠️ Skipping testimonial (model may not exist)' ) ;
121- }
122-
123104 // Create QueryCount if it doesn't exist
124105 try {
125106 await prisma . queryCount . upsert ( {
0 commit comments