example-invoice icon indicating copy to clipboard operation
example-invoice copied to clipboard

Encountered error when seeding database for invoice example

Open aa2858 opened this issue 4 years ago • 1 comments

Got the following error when attempting to seed the database. I checked the code and it seems that the context object is not defined or something like. I am very new react and JS in general but I am will participate in getting this resolved.

/Users/xxxx/project/JS/example-invoice/node_modules/.bin/rw db seed Seeding your database... [started] PrismaClientValidationError: Invalidprisma.invoice.create()` invocation in /Users/aaliu/project/JS/example-invoice/api/prisma/seeds.js:36:38

{ data: { invoiceNumber: '2020001', date: '03/12/2020', body: '{"title":"I N V O I C E","companyName":"Example Inc.","companyInfo":"example.com\[email protected]","recipient":"Michael Scott Paper Company Inc.\n1725 Slough Avenue\nScranton, Pennsylvania","information":[[{"value":"Invoice #"},{"value":"044"}],[{"value":"Date"},{"value":"7/25/2020"}]],"lineItems":[[{"value":"Description"},{"value":"Quantity"},{"value":"Price"}],[{"value":"Wheel of cheese"},{"value":1},{"value":500}],[{"value":"Jar of sausages"},{"value":2},{"value":2.99}],[{"value":"Tin of waffles"},{"value":2},{"value":3.01}]],"summary":[[{"value":"Subtotal"},null,"0.0"],[{"value":"Tax Rate"},{"value":0},"0.0"],[{"value":"Total"},{"value":"$"},"0.0"]],"notesA":"","notesB":"Invoice by billable.me"}',

  • user: {
  • create?: UserCreateWithoutInvoicesInput,
    
  • connect?: UserWhereUniqueInput
    
  • }, ? createdAt?: DateTime, ? updatedAt?: DateTime } }

Argument user for data.user is missing.

` Let me if you have questions.

aa2858 avatar Jul 25 '20 14:07 aa2858

resuming from https://github.com/redwoodjs/example-invoice/issues/43 cc @dale-french

The data models have changed so running yarn rw db seed fails (needs a user).

@peterp Question: are you even using seed.js anymore? I see that the Invoices have default content now, but it's coming from code and not the DB.

thedavidprice avatar Oct 24 '20 01:10 thedavidprice