Nimish Gupta
06/30/2021, 1:48 PMmodel Test {
  id        String   @id @default(uuid())
  name      String   @unique
  values    String[]
  // common fields
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
  @@map("test")
}async function main() {
	await prisma.$connect();
	await prisma.test.deleteMany();
	await prisma.test.create({ data: { name: 'current_value' } });
	const values = ['first', 'second'];
	const allUpdateQuery = await prisma.$queryRaw(
		`UPDATE test set values = $1`,
		values
	);
	console.log(`Successfully runs allUpdateQuery`);
	try {
		const names = ['current_value'];
		const partialUpdateQuery = await prisma.$queryRaw(
			`UPDATE test set values = $1 where name IN $2`,
			values,
			names
		);
		console.log(`Successfully runs partialUpdateQuery`);
	} catch (error) {
		console.log(error);
		/**
		 *  Raw query failed. Code: `42601`. Message: `db error: ERROR: syntax error at or near "$2"`
			{
				code: 'P2010',
				clientVersion: '2.26.0',
				meta: {
					code: '42601',
					message: 'db error: ERROR: syntax error at or near "$2"'
				}
		 */
	}
	process.exit();
}{current_value,new_value}Gonzalo Moreno
06/30/2021, 2:58 PMAman Tiwari
06/30/2021, 4:52 PMLars Ivar Igesund
06/30/2021, 6:32 PMYrobot
07/01/2021, 2:24 AMYrobot
07/01/2021, 2:28 AMconsole.log('Hello World!');Arun Kumar
07/01/2021, 5:43 AMcreatecreatedhatGuy
07/01/2021, 6:02 AMjasci
07/01/2021, 8:54 AMUser...
const user = await prisma.user.findUnique({ where });
...
<some actions that require info from the user record>
...
<some other actions, maybe updating that user record>
// from the resolver should I requery User or return the queried one?
return user;
// OR
return prisma.user.findUnique({ where })Slackbot
07/01/2021, 12:03 PMJemin Kothari
07/01/2021, 1:07 PMprisma.manageCustomFieldCategories.findMany({})"manageCustomFieldCategories": [
      {
        "id": 1126,
        "name": "test",
        "Fields": [
          {
            "id": 0,
            "field_label": "test",
            "is_required": 0,
            "is_active": false
          },
          {
            "id": 1,
            "field_label": "test1",
            "is_required": 0,
            "is_active": true,
          }
        ]
      }
    ]is_activeFieldsmanageCustomFieldCategoriesFieldssven
07/01/2021, 2:17 PMqueryRawSET search_path TO ${config.DATABASE_SCHEMA};)queryRawAlhassan Raad
07/01/2021, 4:57 PMMike Lumos
07/01/2021, 7:33 PMprisma.post.create()tagsmodel Post {
      id String @id @default(cuid())
      slug String @unique
      title String
      body String
      tags Tag[]
    }
    model Tag {
      id String @id @default(cuid())
      posts Post[]
      name String
      slug String @unique
    }t.field('createPost', {
      type: 'Post',
      args: {
        title: nonNull(stringArg()),
        body: stringArg(),
        tags: list(arg({ type: 'TagInput' }))
      },
      resolve: async (_, args, context: Context) => {
        // Create tags if they don't exist
        const tags = await Promise.all(
          args.tags.map((tag) =>
            context.prisma.tag.upsert({
              create: omit(tag, "id"),
              update: tag,
              where: { id: tag.id || "" },
            })
          )
        )
        return context.prisma.post.create({
          data: {
            title: args.title,
            body: args.body,
            slug: `${slugify(args.title)}-${cuid()}`,
            tags: {
              set: [{id:"ckql6n0i40000of9yzi6d8bv5"}]
            },
            authorId: getUserId(context),
            published: true, // make it false once Edit post works.
          },
        })
      },
    })Invalid `prisma.post.create()` invocation:
    {
      data: {
        title: 'Post with tags',
        body: 'Post with tags body',
        slug: 'Post-with-tags-ckql7jy850003uz9y8xri51zf',
        tags: {
          connect: [
            {
              id: 'ckql6n0i40000of9yzi6d8bv5'
            }
          ]
        },
      }
    }
    Unknown arg `tags` in data.tags for type PostUncheckedCreateInput. Available args:
    type PostUncheckedCreateInput {
      id?: String
      title: String
      body: String
      slug: String
    }tagsprisma generateprisma migrateEl
07/01/2021, 7:53 PM[*] Altered column `notes` (default changed from `Some(DbGenerated("''::text"))` to `Some(Value(String("")))`)El
07/01/2021, 7:53 PMHalvor
07/01/2021, 9:04 PMHalvor
07/01/2021, 9:08 PMPeter Kellner
07/01/2021, 10:25 PMconst addedDate = new Date().toISOString();
const noteAdded = prisma.note.create({
  data: {
    description: description,
    title: title,
    active: 1,
    createDate: addedDate,
    noteChangeLogs: {
      create: [
        {
          changeDate: addedDate,
          operation: 'Created',
          details: '',
        },
      ],
    },
  },
  include: {
    noteChangeLogs: true, // Include all posts in the returned object
  },
});Adam
07/02/2021, 12:00 AMdescribePrisma<postgresql://localapp:password@localhost:5432/${UUID}>J Giri
07/02/2021, 12:58 AM@@mapschema.prismamodel User {
  id        String @id @default(cuid())
  firstName String
  lastName  String
  email     String @unique
  password  String
  @@map("user")
}@@mapJ Giri
07/02/2021, 2:15 AM"node_modules/.prisma/client"typegraphql-prisma"node_modules/@generated/typegraphql-prisma""node_module/.prisma/client"typegraphql-prismaimport { User } from ".prisma/client"Gelo
07/02/2021, 3:41 AMGelo
07/02/2021, 3:41 AMJ Giri
07/02/2021, 7:23 AMtypegraphql-prismatypegraphql-prismaUser@Mutation(() => User)
  async register(
    @Arg("firstName") firstName: string,
    @Arg("lastName") lastName: string,
    @Arg("email") email: string,
    @Arg("password") password: string
  ): Promise<User> {
    const hashedPassword = await bcrypt.hash(password, 12);
    const user = await prisma.user.create({
      data: {
        firstName,
        lastName,
        email,
        password: hashedPassword,
      },
    });export class User {
  @TypeGraphQL.Field(_type => String, {
    nullable: false
  })
  id!: string;
  @TypeGraphQL.Field(_type => String, {
    nullable: false
  })
  firstName!: string;
  @TypeGraphQL.Field(_type => String, {
    nullable: false
  })
  lastName!: string;
  @TypeGraphQL.Field(_type => String, {
    nullable: false
  })
  email!: string;
  @TypeGraphQL.Field(_type => String, {
    nullable: false
  })
  password!: string;
}passwordpasswordnpx generatepasswordJ Giri
07/02/2021, 10:19 AMtypegraphql-prismatypegraphql-prismanpm i -D typegraphql-prisma @types/graphql-fields
npm i graphql-scalars graphql-fieldsgenerator typegraphql {
  provider = "typegraphql-prisma"
  output   = "../prisma/generated/type-graphql"
}{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
    "sourceMap": true,
    "outDir": "./dist",
    "moduleResolution": "node",
    "declaration": false,
    // "esModuleInterop": true,
    "composite": false,
    "removeComments": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    // "allowSyntheticDefaultImports": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "baseUrl": "."
    // "rootDir": "src"
  },
  "exclude": ["node_modules"],
  "include": ["./src/**/*.tsx", "./src/**/*.ts"]
}npm startD:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:587
    return new TSError(diagnosticText, diagnosticCodes);
           ^
TSError: ⨯ Unable to compile TypeScript:
prisma/generated/type-graphql/models/User.ts:2:1 - error TS6133: 'GraphQLScalars' is declared but its value is never read.
2 import * as GraphQLScalars from "graphql-scalars";
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prisma/generated/type-graphql/models/User.ts:3:1 - error TS6133: 'Prisma' is declared but its value is never read.
3 import { Prisma } from "@prisma/client";
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prisma/generated/type-graphql/models/User.ts:4:1 - error TS6133: 'DecimalJSScalar' is declared but its value is never read.
4 import { DecimalJSScalar } from "../scalars";
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at createTSError (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:587:12)
    at reportTSError (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:591:19)
    at getOutput (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:921:36)
    at Object.compile (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:1189:32)
    at Module.m._compile (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:1295:42)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions.<computed> [as .ts] (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:1298:12)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)khareta
07/02/2021, 1:48 PMError in connector: Error creating a database connection. (Timed out fetching a connection from the pool (connection limit: 50, in use: 17))Ariel Flesler
07/02/2021, 4:53 PMmodel Group {
  id         String        @id @default(cuid())
  members    User[] @relation(fields: [memberIds], references: [id])
  memberIds   String[]
}Andy
07/02/2021, 5:59 PMError: Database error
Error querying the database: db error: ERROR: invalid string in message
   0: sql_migration_connector::flavour::postgres::sql_schema_from_migration_history
             at migration-engine/connectors/sql-migration-connector/src/flavour/postgres.rs:367
   1: migration_core::api::DevDiagnostic
             at migration-engine/core/src/api.rs:89