[GH-ISSUE #649] ERR! Missing script: "db-migrate:dev" #180

Closed
opened 2026-02-26 18:45:44 +03:00 by kerem · 5 comments
Owner

Originally created by @Dominion0815 on GitHub (Nov 13, 2023).
Original GitHub issue: https://github.com/documenso/documenso/issues/649

Issue Description

Documenso no longer starts, even a complete fresh installation throws this error:


docker-documenso-1  | npm ERR! Missing script: "db-migrate:dev"

...

docker-documenso-1  | @documenso/web:dev:  ⨯ Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.

Steps to Reproduce

  • git clone repo
  • docker compose up

Expected Behavior

No response

Current Behavior

No response

Screenshots (optional)

No response

Operating System [e.g., Windows 10]

No response

Browser [e.g., Chrome, Firefox]

No response

Version [e.g., 2.0.1]

No response

Please check the boxes that apply to this issue report.

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have provided steps to reproduce the issue.
  • I have included relevant environment information.
  • I have included any relevant screenshots.
  • I understand that this is a voluntary contribution and that there is no guarantee of resolution.
  • I want to work on creating a PR for this issue if approved
Originally created by @Dominion0815 on GitHub (Nov 13, 2023). Original GitHub issue: https://github.com/documenso/documenso/issues/649 ### Issue Description Documenso no longer starts, even a complete fresh installation throws this error: ``` docker-documenso-1 | npm ERR! Missing script: "db-migrate:dev" ... docker-documenso-1 | @documenso/web:dev: ⨯ Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. ``` ### Steps to Reproduce - git clone repo - docker compose up ### Expected Behavior _No response_ ### Current Behavior _No response_ ### Screenshots (optional) _No response_ ### Operating System [e.g., Windows 10] _No response_ ### Browser [e.g., Chrome, Firefox] _No response_ ### Version [e.g., 2.0.1] _No response_ ### Please check the boxes that apply to this issue report. - [X] I have searched the existing issues to make sure this is not a duplicate. - [X] I have provided steps to reproduce the issue. - [X] I have included relevant environment information. - [X] I have included any relevant screenshots. - [X] I understand that this is a voluntary contribution and that there is no guarantee of resolution. - [X] I want to work on creating a PR for this issue if approved
kerem 2026-02-26 18:45:44 +03:00
  • closed this issue
  • added the
    type: bug
    label
Author
Owner

@Mythie commented on GitHub (Nov 13, 2023):

Thanks for catching this! Change was trivial so I've unfortunately already gone ahead with the PR #650

<!-- gh-comment-id:1807740134 --> @Mythie commented on GitHub (Nov 13, 2023): Thanks for catching this! Change was trivial so I've unfortunately already gone ahead with the PR #650
Author
Owner

@Dominion0815 commented on GitHub (Nov 13, 2023):

@Mythie now I got this error::

A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Migration name: 20230621131348_add_document_id_and_email_index

Database error code: 23505

Database error:
ERROR: could not create unique index "Recipient_documentId_email_key"
DETAIL: Key ("documentId", email)=(3, sdfgsdfg@werer.com) is duplicated.

DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E23505), message: "could not create unique index \"Recipient_documentId_email_key\"", detail: Some("Key (\"documentId\", email)=(3, sdfgsdfg@werer.com) is duplicated."), hint: None, position: None, where_: None, schema: Some("public"), table: Some("Recipient"), column: None, datatype: None, constraint: Some("Recipient_documentId_email_key"), file: Some("tuplesort.c"), line: Some(4423), routine: Some("comparetup_index_btree") }

   0: sql_schema_connector::apply_migration::apply_script
           with migration_name="20230621131348_add_document_id_and_email_index"
             at schema-engine/connectors/sql-schema-connector/src/apply_migration.rs:106
   1: schema_core::commands::apply_migrations::Applying migration
           with migration_name="20230621131348_add_document_id_and_email_index"
             at schema-engine/core/src/commands/apply_migrations.rs:91
   2: schema_core::state::ApplyMigrations
             at schema-engine/core/src/state.rs:201
<!-- gh-comment-id:1808023982 --> @Dominion0815 commented on GitHub (Nov 13, 2023): @Mythie now I got this error:: ``` A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve Migration name: 20230621131348_add_document_id_and_email_index Database error code: 23505 Database error: ERROR: could not create unique index "Recipient_documentId_email_key" DETAIL: Key ("documentId", email)=(3, sdfgsdfg@werer.com) is duplicated. DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E23505), message: "could not create unique index \"Recipient_documentId_email_key\"", detail: Some("Key (\"documentId\", email)=(3, sdfgsdfg@werer.com) is duplicated."), hint: None, position: None, where_: None, schema: Some("public"), table: Some("Recipient"), column: None, datatype: None, constraint: Some("Recipient_documentId_email_key"), file: Some("tuplesort.c"), line: Some(4423), routine: Some("comparetup_index_btree") } 0: sql_schema_connector::apply_migration::apply_script with migration_name="20230621131348_add_document_id_and_email_index" at schema-engine/connectors/sql-schema-connector/src/apply_migration.rs:106 1: schema_core::commands::apply_migrations::Applying migration with migration_name="20230621131348_add_document_id_and_email_index" at schema-engine/core/src/commands/apply_migrations.rs:91 2: schema_core::state::ApplyMigrations at schema-engine/core/src/state.rs:201 ```
Author
Owner

@ephraimduncan commented on GitHub (Nov 14, 2023):

Looks like you're trying to create a unique index based on the migration but you have duplicate values that will break because it won't be unique anymore.

Try this before running your migration

npx prisma migrate reset --schema packages/prisma/schema.prisma
<!-- gh-comment-id:1811284137 --> @ephraimduncan commented on GitHub (Nov 14, 2023): Looks like you're trying to create a unique index based on the migration but you have duplicate values that will break because it won't be unique anymore. Try this before running your migration ``` npx prisma migrate reset --schema packages/prisma/schema.prisma ```
Author
Owner

@Dominion0815 commented on GitHub (Nov 16, 2023):

oh he will empty the database...

root@68940f5416dc:/app# npx prisma migrate reset --schema packages/prisma/schema.prisma
Prisma schema loaded from packages/prisma/schema.prisma
Datasource "db": PostgreSQL database "documenso", schema "public" at "database:5432"

✔ Are you sure you want to reset your database? All data will be lost.
<!-- gh-comment-id:1814202055 --> @Dominion0815 commented on GitHub (Nov 16, 2023): oh he will empty the database... ``` root@68940f5416dc:/app# npx prisma migrate reset --schema packages/prisma/schema.prisma Prisma schema loaded from packages/prisma/schema.prisma Datasource "db": PostgreSQL database "documenso", schema "public" at "database:5432" ✔ Are you sure you want to reset your database? All data will be lost. ```
Author
Owner

@catalinpit commented on GitHub (Nov 17, 2023):

This seems solved! If there's an issue, feel free to open a new issue. Thanks!

<!-- gh-comment-id:1816163404 --> @catalinpit commented on GitHub (Nov 17, 2023): This seems solved! If there's an issue, feel free to open a new issue. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#180
No description provided.