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

    Rizwan Anwar

    05/20/2020, 8:16 PM
    Hey guys! Can anyone please help. When i initialize prisma app and then run docker-compose up -d and then prisma-deploy it deployed all the changes made to data model but when i run it again today it open up a console in browser and not deploying the changes.
  • c

    Chazzz

    05/20/2020, 9:51 PM
    Is there a way to export data from https://app.prisma.io/ ?
    ➕ 2
    s
    • 2
    • 3
  • r

    Rizwan Anwar

    05/21/2020, 7:39 AM
    Hey! can anyone help when im doing prisma deploy it is throwing error no cluster could be found for workspace '*' and cluster 'default'. I am using docker and prisma
  • m

    Mike SOK

    05/21/2020, 1:35 PM
    Hi Guys, I created an increment and decrement on the cartItems but I am trying to remove the item from the cart when the quantity is less than < 1. Here is the code for my mutation does anyone know how this can be achieved?
    Copy code
    async minusFromCart(parent, args, ctx, info) {
    	    // 1. Make sure they are signed in
    	    const { userId } = ctx.request;
    	    if (!userId) {
    	      throw new Error('You must be signed in soooon');
    	    }
    
    	    // 2. Query the users current cart
    	    const [existingCartItem] = await ctx.db.query.cartItems({
    	      where: {
    	        user: { id: userId },
    	        item: { id: args.id },
    	      },
    	    });
    	    // 3. Check if that item is already in their cart and increment by 1 if it is
    	    if (existingCartItem) {
    	      console.log('This item is already in their cart');
    	      return ctx.db.mutation.updateCartItem(
    	        {
    	          where: { id: existingCartItem.id },
    	          data: { quantity: existingCartItem.quantity - 1 },
    	        },
    	        info
    	      );
    	    }
    
    	    //1. Find the cart item
    		const cartItem = await ctx.db.query.cartItem(
    			{
    			where: {
    					id: args.id,
    				},
    			},
    		`{ id, user { id }}`
    		);
    
    	    if (existingCartItem < 1) {
    	      	//3. Delete that cart Item
    			return ctx.db.mutation.deleteCartItem ({
    				where: { id: args.id },
    			}, info);
    	    }
    	},
    @Harshit
  • a

    Abhischek

    05/21/2020, 1:40 PM
    Hi anyone using prisma with MongoDB v4.2 and getting an error:
    IndexOptionsConflict
    when trying to deploy? I have multiple documents referencing the field it's complaining about using a
    @relation(link: INLINE)
    Specifying a named
    @relation()
    didn't really help so wondering if anyone faced a similar issue
    c
    • 2
    • 2
  • p

    Philipp Rajah Moura Srivastava

    05/21/2020, 11:25 PM
    So I’ve been developing a mobile application the past 2 weeks that requires mongoDB or any noSQL database. Being it that prisma 2 does not yet support mongoDB i am being forced to develop with prisma 1. Does anybody know how difficult it is to migrate? for when mongoDB is available. And does anyone know how long prisma 1 will be supported?
    f
    r
    • 3
    • 7
  • m

    Mohamed Nabawy

    05/22/2020, 4:01 PM
    whats up community
  • m

    Mohamed Nabawy

    05/22/2020, 4:02 PM
    how to create a prisma end point server ?
    a
    • 2
    • 1
  • m

    Mohamed Nabawy

    05/22/2020, 4:30 PM
    i want to create an endpoint for Prisma server
  • a

    Aaron Fulkerson

    05/22/2020, 10:14 PM
    I haven't tried this personally, thought maybe I could get a quick answer here. Does findMany return the total number of records for a query? Asking for pagination.
    t
    r
    • 3
    • 3
  • i

    Ippo

    05/23/2020, 3:00 AM
    is it possible, in prisma 2, to use permission based authorization? with that I mean: a user have many roles a role has many permissions
    r
    • 2
    • 6
  • g

    Glen

    05/23/2020, 7:39 AM
    Woohoo. Great to be here. Thanks so much for your work on Prisma / Prisma 2 guys!!
    🙌 2
  • g

    Glenn Dwiyatcita

    05/23/2020, 9:36 AM
    Hello Prisma Tutorial Team, upon following this step of react-apollo tutorial (https://www.howtographql.com/react-apollo/6-more-mutations-and-updating-the-store/ - see the "Calling Mutation" section), I noticed that the vote is already updated in the UI even without refreshing the page or updating the cache. Any idea why this is so? 🤔
    • 1
    • 1
  • p

    Pavlo Strunkin

    05/23/2020, 10:27 AM
    I’m using prisma migration and would like to move column from one table to another together with data DB schema transformation works good, but I’s not clear for me how could I migrate the data from those columns? I guess that changing README file with sql query inside is only for information purpose is there any tutorial for this or I’m not getting the concept?
    r
    • 2
    • 2
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 7:04 PM
    Does anybody know how to define a relation directive to self? I’m using prisma 1 because of the mongo support and I have it defined as @relation(name: “UserToUser”, onDelete: SET_NULL). I also have trying to do a many to many relation with the directive @relation(name: “UserToPost”, onDelete: SET_NULL) on both of the object types
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 7:05 PM
    am I doing that right?
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 7:10 PM
    also what if you want a relation between an embedded type and a regular type?
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 7:21 PM
    or alternatively can someone point be to a good prisma relations tutoriaL? Ican’t find one
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:45 PM
    I have figured out the relations fiasco…I hope. Now I’m getting an error when using embedded types
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:45 PM
    the error is
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:45 PM
    ▸  ‘;’ expected. (138:8)  ▸    136 | export type CommentsOrderByInput  ▸  =   ▸    137 |   ▸  > 138 | export type  ▸  CommentOrderByInput =  ‘comment_ASC’  ▸  |  ▸      |     ^  ▸    139 |  ‘comment_DESC’  ▸    140 |   ▸    141 | export type SquadOrderByInput  ▸  =  ‘id_ASC’ |
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:46 PM
    Where Comments is an embedded type
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:47 PM
    I think it’s because I’m doing it like this
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:47 PM
    type Comments @embedded { comments: [Comment]! } type Comment @embedded { createdBy: User! @relation(name: “CommentRelation”, link: INLINE, onDelete: SET_NULL) comment: String! }
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:47 PM
    and Comments is embedded in another object
  • p

    Philipp Rajah Moura Srivastava

    05/23/2020, 10:47 PM
    but is there another way I can embed an array into an object?
  • p

    Philipp Rajah Moura Srivastava

    05/24/2020, 12:34 AM
    prisma generate does not seem to work with embedded types
  • a

    Ahmed Ghanem

    05/24/2020, 12:40 AM
    type Meta {
    id: ID! @id @unique
    firstName: String
    user: User @relation(name: "UserToMeta")
    }
    type User {
    id: ID! @id @unique
    username: String!
    meta: Meta @relation(link: INLINE,name: "UserToMeta", onDelete: CASCADE)
    }
  • a

    Ahmed Ghanem

    05/24/2020, 12:41 AM
    delete cascade doesn't work
  • a

    Ahmed Ghanem

    05/24/2020, 12:41 AM
    i want to delete the meta record when delete the user
1...374375376...637Latest