1- import ' dotenv/config'
2- import pg from 'pg'
3- import { PrismaPg } from ' @prisma/adapter-pg'
4- import { PrismaClient } from ' ../src/generated/prisma/index.js'
1+ import " dotenv/config" ;
2+ import pg from "pg" ;
3+ import { PrismaPg } from " @prisma/adapter-pg" ;
4+ import { PrismaClient } from " ../src/generated/prisma/index.js" ;
55
66// Connect to whatever database is specified by DATABASE_URL
7- const pool = new pg . Pool ( { connectionString : process . env . DATABASE_URL } )
7+ const pool = new pg . Pool ( { connectionString : process . env . DATABASE_URL } ) ;
88
9- const adapter = new PrismaPg ( pool as any )
9+ const adapter = new PrismaPg ( pool ) ;
1010
11- const prisma = new PrismaClient ( { adapter } )
11+ const prisma = new PrismaClient ( { adapter } ) ;
1212
1313async function main ( ) {
1414 // Fake Supabase user IDs
15- const adminSupabaseId = ' 00000000-0000-0000-0000-000000000001'
16- const userSupabaseId = ' 00000000-0000-0000-0000-000000000002'
15+ const adminSupabaseId = " 00000000-0000-0000-0000-000000000001" ;
16+ const userSupabaseId = " 00000000-0000-0000-0000-000000000002" ;
1717
1818 const admin = await prisma . user . upsert ( {
1919 where : { supabaseUserId : adminSupabaseId } ,
2020 update : { } ,
2121 create : { supabaseUserId : adminSupabaseId , isAdmin : true } ,
22- } )
22+ } ) ;
2323
2424 const user = await prisma . user . upsert ( {
2525 where : { supabaseUserId : userSupabaseId } ,
2626 update : { } ,
2727 create : { supabaseUserId : userSupabaseId , isAdmin : false } ,
28- } )
28+ } ) ;
2929
3030 const project1 = await prisma . project . create ( {
31- data : { name : ' Attendance Manager' , description : ' Cool project' } ,
32- } )
31+ data : { name : " Attendance Manager" , description : " Cool project" } ,
32+ } ) ;
3333
3434 const project2 = await prisma . project . create ( {
35- data : { name : ' Website Creation' , description : ' Less project' } ,
36- } )
35+ data : { name : " Website Creation" , description : " Less project" } ,
36+ } ) ;
3737
3838 await prisma . userProject . createMany ( {
3939 data : [
@@ -42,22 +42,22 @@ async function main() {
4242 { userId : user . id , projectId : project1 . id } ,
4343 ] ,
4444 skipDuplicates : true ,
45- } )
45+ } ) ;
4646
4747 await prisma . session . create ( {
4848 data : {
4949 userId : admin . id ,
5050 projectId : project1 . id ,
51- token : ' admin-session-token' ,
51+ token : " admin-session-token" ,
5252 expiresAt : new Date ( Date . now ( ) + 1000 * 60 * 60 * 24 ) , // 24h
5353 } ,
54- } )
54+ } ) ;
5555
56- console . log ( ' data seeded!' )
56+ console . log ( " data seeded!" ) ;
5757}
5858
5959main ( )
6060 . catch ( console . error )
6161 . finally ( async ( ) => {
62- await prisma . $disconnect ( )
63- } )
62+ await prisma . $disconnect ( ) ;
63+ } ) ;
0 commit comments