MCPcopy Create free account
hub / github.com/prisma/prisma-examples / main

Function main

databases/cockroachdb/src/script.ts:14–252  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13// A `main` function so that we can use async/await
14async function main() {
15 const tags = await Promise.all([
16 prisma.tag.create({
17 data: {
18 tag: 'Node.js',
19 },
20 }),
21 prisma.tag.create({
22 data: {
23 tag: 'TypeScript',
24 },
25 }),
26 prisma.tag.create({
27 data: {
28 tag: 'Prisma',
29 },
30 }),
31 prisma.tag.create({
32 data: {
33 tag: 'Databases',
34 },
35 }),
36 prisma.tag.create({
37 data: {
38 tag: 'Cockroach Labs',
39 },
40 }),
41 prisma.tag.create({
42 data: {
43 tag: 'Serverless',
44 },
45 }),
46 ])
47
48 console.log('Created tags: \n', prettyjson.render(tags))
49
50 // Seed the database with users and posts
51 const user1 = await prisma.user.create({
52 data: {
53 email: 'alice@prisma.io',
54 name: 'Alice',
55 posts: {
56 create: {
57 title: 'Productive development with Prisma and CockroachDB',
58 published: true,
59 tags: {
60 connect: [
61 {
62 tag: 'Prisma',
63 },
64 {
65 tag: 'Cockroach Labs',
66 },
67 ],
68 },
69 },
70 },
71 },

Callers

nothing calls this directly

Calls 2

postsMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected