question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ID not incremented on MySQL and Postgres

See original GitHub issue

When you design a new Prisma model for MySQL. The first insert works, the second fail.

 UnhandledPromiseRejectionWarning: Error: Error in Photon: 
ConnectorError(UniqueConstraintViolation { field_name: "User.id" })

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
divyenduzcommented, Aug 16, 2019

Workaround for now: Manually edit the MySQL column to add auto increment property. Like,

ALTER TABLE <table-name> MODIFY COLUMN <column-name> INT auto_increment

Example, ALTER TABLE document MODIFY COLUMN document_id INT auto_increment

1reaction
mavileincommented, Aug 26, 2019

This is fixed now. Should be available on alpha soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

postgres autoincrement not updated on explicit id inserts
Explicit or not, mysql always update autoincrement pointer based on the max row id. What is the workaround for this problem in postgres?...
Read more >
Defining an Auto Increment Primary Key in PostgreSQL - Chartio
Learn how to define an auto increment primary key in PostgreSQL. ... CREATE TABLE books ( id SERIAL PRIMARY KEY, title VARCHAR(100) NOT...
Read more >
Reset Auto-Increment IDs in Postgres - Brian Childress
If you've ever needed to “reset” the auto-incrementing row ID in a Postgres database here is a simple command to start fresh (this...
Read more >
Prevent Primary Key increment when an INSERT statement ...
As you can see the id is automatically incremented and the name must be unique. Every time I run an INSERT sql statements,...
Read more >
PostgreSQL - SERIAL - Generate IDs (Identity, Auto-increment)
When you define a SERIAL column, PostgreSQL automatically changes column to NOT NULL, creates a sequence tablename_serialcol_seq and DEFAULT NEXTVAL to select ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found