https://www.prisma.io/ logo
Join SlackCommunities
Powered by
# orm-help
  • k

    KJReactor

    10/01/2019, 11:45 PM
    Am I the only one having issues with
    OR
    is the where variable?
  • k

    KJReactor

    10/01/2019, 11:46 PM
    I'm getting errors that its undefined
  • l

    Li Arolf Rey

    10/02/2019, 12:19 AM
    Hi guys, anybody having issues using the
    Copy code
    prisma login --key {SESSION_KEY}
    in prisma-cli? It still opens the browser for me, which makes my CI/CD build fail.
  • l

    Li Arolf Rey

    10/02/2019, 12:19 AM
    https://www.prisma.io/docs/prisma-cli-and-configuration/cli-command-reference/prisma-login-ycv4/
  • j

    Jaume

    10/02/2019, 9:45 AM
    Hi I have a question: is there anyway in prisma to setup events/listeners like in typeORM (https://typeorm.io/#/listeners-and-subscribers) ? I've seen some directives like
    @createdAt
    and
    @updatedAt
    but nothing more a part of this. A use case might to encrypt a password before update always like this implementation for mongoose:
    Copy code
    UserSchema.pre("save", function(next) {
        this.password = Bcrypt.hashSync(this.password, 10);
        next();
    });
    thx in advance šŸ™‚
    k
    m
    • 3
    • 5
  • k

    KJReactor

    10/02/2019, 11:48 AM
    The filter
    OR
    is not working for me even after copying the exact example from the docs:
    Copy code
    const filteredPosts: Post[] = await prisma.posts({
      where: {
        OR: [
          {
            title_contains: 'graphql',
          },
          {
            title_contains: 'prisma',
          },
        ],
        createdAt_gt: '2018',
        createdAt_lt: '2020',
      },
    })
    where
    alone works with one condition but keep getting errors that
    OR
    does not exist
  • s

    Simskii

    10/02/2019, 1:19 PM
    Hi i have a question regarding prisma-client-typescript i get a babel error on runtime. I’m unable to resolve why this is happening. Syntax error …generated/prisma-client/index.ts: Unexpected token (9:12)
    -.js
  • s

    sapkra

    10/02/2019, 4:45 PM
    Hey guys, does anyone know when we can expect subscription support for Prisma 2?
    m
    a
    • 3
    • 5
  • j

    Junsu Kim

    10/03/2019, 7:48 AM
    Can I use id in numerical form auto increment?
  • k

    KJReactor

    10/03/2019, 5:46 PM
    What is the use of the
    info
    resolver argument? Howtographql does not elaborate on that
  • d

    deactivateduser

    10/03/2019, 9:10 PM
    How can I filter a set of items which have a DateTime field to only retrieve items in between two provided dates?
  • m

    Max Hodges

    10/04/2019, 6:12 AM
    are there any docs about system requirments for prisma? I searched docs for ā€œRAMā€ and ā€œGBā€ but not zero results.
  • m

    Max Hodges

    10/04/2019, 6:12 AM
    found some mentions in the issues, but is there nothing official?
    l
    j
    • 3
    • 7
  • b

    Bjarne Petersen

    10/04/2019, 7:08 AM
    Does prisma (1+2) rely on IDs being globally unique (like in dataloader, cache etc.)? The reason I'm asking is that we are moving legacy data to prisma 1 using
    prisma import
    which enables us to retain the legacy datas IDs, but they are not globally unique. Are there any tripwires we should be aware of in this regard?
    j
    r
    • 3
    • 10
  • j

    JamesJ

    10/04/2019, 2:12 PM
    Still getting used to working with Prisma, but as I haven’t already just wanted to say a huge shout out to all you guys working on Prisma and Prisma 2 - really incredible work. Thank you!
    ā¤ļø 2
  • d

    deactivateduser

    10/04/2019, 3:04 PM
    How do I create a relation between two items when creating a new one? I wanna connect one item to one user and I would like to identify the user with his email. I added the email as an unique field to the datamodel and added the connection like that:
    Copy code
    user: {
              connect: {
                email: args.email
              }
            }
    Is that not sufficient? I receive the following error: Field value.user of required type UserCreateOneInput! was not provided. When I check the generated file I see:
    Copy code
    input UserWhereUniqueInput {
      id: ID
      email: String
    }
    For me that means that I can either identify the user through his id or his email, or do I understand something, perhaps the error, wrong?
  • n

    nf.dominguez

    10/04/2019, 3:07 PM
    I think the error is related with typescript and how you are writing the resolver
  • n

    nf.dominguez

    10/04/2019, 3:07 PM
    some arguments seems not to be correct
  • d

    deactivateduser

    10/04/2019, 3:10 PM
    Inside the resolver I receive the appropriate arguments I need for the creation, so I think the GraphQL part here is correct. Maybe the syntax I use to create the item is wrong?
    Copy code
    const item = await ctx.db.mutation.createItem(
          {
            user: {
              connect: {
                email: args.email
              }
            },
            data: { title: args.title }
          },
          info
        );
    The type:
    Copy code
    type Item {
      id: ID! @id
      title: String!
      createdAt: DateTime! @createdAt
      updatedAt: DateTime! @updatedAt
      user: User!
    }
  • d

    deactivateduser

    10/04/2019, 3:17 PM
    Oh well, I nested it wrong. The connection to the user is supposed to be inside of the data key šŸ¤¦ā€ā™‚ļø
  • p

    Phakah

    10/04/2019, 10:27 PM
    Hey I am new to Prisma anyone help I am trying to create user mutation via react-apollo but its not working, I came across an error and I do not know how to fix it. The error says: 'Uncaught (in promise) Error: GraphQL error: Unknown argument 'firstName' on field 'createStudent' of type 'Mutation'. (line 2, column 17): createStudent(firstName: $firstName, lastName: $lastName, studentNumber: $studentNumber, contact: $contact, password: $password) {'
  • c

    Chris Mugnier

    10/05/2019, 9:20 AM
    I will be in Vietnam - Saigon next week - any fan of Prisma around let's have a coffee
  • c

    Chris Mugnier

    10/05/2019, 9:24 AM
    @nghinguyen
  • c

    Chris Mugnier

    10/05/2019, 9:24 AM
    @nguyendk82
  • c

    Chris Mugnier

    10/05/2019, 9:24 AM
    @bkstorm
  • c

    Chris Mugnier

    10/05/2019, 9:24 AM
    @thai
  • h

    Heade

    10/05/2019, 12:39 PM
    hello guys I keep getting this error on my browser and CMD
    Copy code
    Field "id" is not defined by type SubCategoryCreateOneWithoutItemsInput at value.subCategory
    I am using Nextjs, Apollo, Graphql Yoga with Prisma and my schema is
    Copy code
    type Mutation {
      createItem(
        title: String
        description: String
        price: Int
        image: String
        subCategory: SubCategoryInput
        published: Boolean
      ): Item!
    }
    
    input SubCategoryInput {
      id: ID!
      name: String
      body: String
      image: String
      items: [ItemInput]
      category: CategoryInput
    }
    d
    • 2
    • 1
  • d

    deactivateduser

    10/05/2019, 3:07 PM
    Anyone uses TypeScript with Prisma? I am doing:
    Copy code
    const user: IUser = await db.query.user(
        { where: { id: req.userId } },
        '{ id, permissions, email, name }'
      );
    And I just recently moved my prisma import to from
    const { Prisma } = require('prisma-binding');
    to
    import { Prisma } from 'prisma-binding';
    Now I receive a type error, stating that the second argument to my user function (basically
    '{ id, permissions, email, name }'
    ) has the wrong type and is not of type
    [key: string]: any;
    . The types are coming, for whatever reason, from graphql-bindings -- and are defined as the following:
    Copy code
    export interface QueryMap {
        [rootField: string]: (args?: {
            [key: string]: any;
        }, context?: {
            [key: string]: any;
        }, info?: GraphQLResolveInfo | string) => Promise<any>;
    }
    So I think the object I am providing is supposed to be the info object but I couldn't imagine that the syntax or the parameter order changes due to the switch to typescript... šŸ¤”
  • d

    deactivateduser

    10/05/2019, 4:30 PM
    Whew... what a ride. Why can I not use the User type exported from the generated client as a type for a variable when using await? It says it then misses things like then(). Basically I am doing:
    const user: User = await prisma.user({ id: req.userId });
    where User is:
    import { User } from './generated/prisma-client';
    . It results in:
    Type 'UserNode' is missing the following properties from type 'User': then, catch, [Symbol.toStringTag], finally, $fragment
    All the examples are working like that tho, see: https://codesandbox.io/s/x7o68w0pzp?module=%2Fsrc%2Freading-data%2Flists-and-single-objects.ts Line 14
  • d

    deactivateduser

    10/05/2019, 4:35 PM
    Plus can I not pass the info object to prisma.user to only retrieve certain fields (when using graphql)?
1...316317318...637Latest