getting-things-done-in-next-js icon indicating copy to clipboard operation
getting-things-done-in-next-js copied to clipboard

C(10.4): Duplicate key value violates unique constraint after creating task in DB directly

Open ricayanzon opened this issue 7 months ago • 0 comments

Describe the bug If you create a new instance for one of the tables, e.g. task, in Supabase directly and enter the id manually, the client throws an error when trying to create a new instance with the same id.

Expected behavior Drizzle or whatever, should recognize that the key exists and skip to the next available id in the sequence.

Additional Notes Steps to reproduce:

  • Create a new task in the DB directly and set the task_id manually to 1.
  • Switch over to the client and refresh. New task should appear in the UI.
  • Try to create a new task from the interface.
  • On submit, you should see the following error: PostgresError: duplicate key value violates unique constraint "task_pkey"

ricayanzon avatar Jul 13 '24 23:07 ricayanzon