next-learn
next-learn copied to clipboard
errors running npm run seed
only 3 table were populated in vercel postgres db
error message
bluewizard888888@cloudshell:~/learn_next/nextjs-dashboard$ npm run seed
> seed
> node -r dotenv/config ./scripts/seed.js
Created "users" table
Seeded 1 users
Created "customers" table
Seeded 10 customers
Created "invoices" table
Error seeding invoices: error: null value in column "customer_id" of relation "invoices" violates not-null constraint
at on.parseErrorMessage (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1174:6)
at on.handlePacket (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1135:48)
at on.parse (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1119:63)
at x.<anonymous> (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1181:74)
at x.emit (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:395:63)
at WebSocket.<anonymous> (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:992:19)
at callListener (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onMessage (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/ws/lib/event-target.js:209:9)
at WebSocket.emit (node:events:518:28)
at Receiver.receiverOnMessage (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/ws/lib/websocket.js:1192:20) {
length: 273,
severity: 'ERROR',
code: '23502',
detail: 'Failing row contains (4d230962-5ad7-4f9d-a26d-5c67439b653b, null, 44800, paid, 2023-09-10).',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: 'public',
table: 'invoices',
column: 'customer_id',
dataType: undefined,
constraint: undefined,
file: 'execMain.c',
line: '2003',
routine: 'ExecConstraints'
}
An error occurred while attempting to seed the database: error: null value in column "customer_id" of relation "invoices" violates not-null constraint
at on.parseErrorMessage (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1174:6)
at on.handlePacket (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1135:48)
at on.parse (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1119:63)
at x.<anonymous> (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:1181:74)
at x.emit (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:395:63)
at WebSocket.<anonymous> (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/@neondatabase/serverless/index.js:992:19)
at callListener (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onMessage (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/ws/lib/event-target.js:209:9)
at WebSocket.emit (node:events:518:28)
at Receiver.receiverOnMessage (/home/bluewizard888888/learn_next/nextjs-dashboard/node_modules/ws/lib/websocket.js:1192:20) {
length: 273,
severity: 'ERROR',
code: '23502',
detail: 'Failing row contains (4d230962-5ad7-4f9d-a26d-5c67439b653b, null, 44800, paid, 2023-09-10).',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: 'public',
table: 'invoices',
column: 'customer_id',
dataType: undefined,
constraint: undefined,
file: 'execMain.c',
line: '2003',
bump