-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseed.ts
47 lines (42 loc) · 1.18 KB
/
seed.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {PrismaClient , Prisma} from '@prisma/client'
// import { PrismaClient, Prisma } from './generated.old/prisma-client-js'
// import {TokenCreateInput} from '../src/TokenResolver';
const prisma = new PrismaClient()
const tokenData: Prisma.TokenCreateInput[] = [
// {
// name: 'Solana',
// symbol: 'SOL',
// description: 'temp description of Solana',
// sol_address: 'So11111111111111111111111111111111111111112',
// gecko_id: 'solana',
// website: 'solana.com',
// twitter: 'twitter.com/solana'
// },
// {
// name: 'Serum',
// symbol: 'SRM',
// description: 'temp description of Serum',
// sol_address: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt',
// gecko_id: 'serum',
// website: 'projectserum.com',
// twitter: 'twitter.com/projectserum'
// },
]
async function main() {
console.log(`Start seeding ...`)
for (const t of tokenData) {
const token = await prisma.token.create({
data: t,
})
console.log(`Created token with id: ${token.id}`)
}
console.log(`Seeding finished.`)
}
main()
.catch((e) => {
console.error(e)
process.exit(1)
})
.finally(async () => {
await prisma.$disconnect()
})