Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] - The foreign key constraint "user_to_collection-fk1" cannot be implemented #855

Closed
ebiagi opened this issue Jun 2, 2024 · 3 comments

Comments

@ebiagi
Copy link

ebiagi commented Jun 2, 2024

Hi, upgrading to the latest version throws the following DB error (with the variable RUST_LOG=trace on )

[backend] 2024-06-02T15:05:51.206306Z  INFO sea_orm_migration::migrator: Applying migration 'm20240509_create_user_to_collection'
[backend] 2024-06-02T15:05:51.206471Z DEBUG execute{self=DatabaseTransaction stmt=Statement { sql: "CREATE TABLE \"user_to_collection\" ( \"user_id\" integer, \"collection_id\" text NOT NULL, CONSTRAINT \"pk-user_to_collection\" PRIMARY KEY (\"user_id\", \"collection_id\"), CONSTRAINT \"user_to_collection-fk1\" FOREIGN KEY (\"collection_id\") REFERENCES \"collection\" (\"id\") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT \"user_to_collection-fk2\" FOREIGN KEY (\"user_id\") REFERENCES \"user\" (\"id\") ON DELETE CASCADE ON UPDATE CASCADE )", values: None, db_backend: Postgres }}: sea_orm::database::transaction: CREATE TABLE "user_to_collection" ( "user_id" integer, "collection_id" text NOT NULL, CONSTRAINT "pk-user_to_collection" PRIMARY KEY ("user_id", "collection_id"), CONSTRAINT "user_to_collection-fk1" FOREIGN KEY ("collection_id") REFERENCES "collection" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "user_to_collection-fk2" FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE )
[backend] 2024-06-02T15:05:51.214559Z  INFO execute{self=DatabaseTransaction stmt=Statement { sql: "CREATE TABLE \"user_to_collection\" ( \"user_id\" integer, \"collection_id\" text NOT NULL, CONSTRAINT \"pk-user_to_collection\" PRIMARY KEY (\"user_id\", \"collection_id\"), CONSTRAINT \"user_to_collection-fk1\" FOREIGN KEY (\"collection_id\") REFERENCES \"collection\" (\"id\") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT \"user_to_collection-fk2\" FOREIGN KEY (\"user_id\") REFERENCES \"user\" (\"id\") ON DELETE CASCADE ON UPDATE CASCADE )", values: None, db_backend: Postgres }}: sqlx::query: summary="CREATE TABLE \"user_to_collection\" ( ..." db.statement="\n\nCREATE TABLE \"user_to_collection\" (\n  \"user_id\" integer,\n  \"collection_id\" text NOT NULL,\n  CONSTRAINT \"pk-user_to_collection\" PRIMARY KEY (\"user_id\", \"collection_id\"),\n  CONSTRAINT \"user_to_collection-fk1\" FOREIGN KEY (\"collection_id\") REFERENCES \"collection\" (\"id\") ON DELETE CASCADE ON\n  UPDATE\n    CASCADE,\n    CONSTRAINT \"user_to_collection-fk2\" FOREIGN KEY (\"user_id\") REFERENCES \"user\" (\"id\") ON DELETE CASCADE ON\n  UPDATE\n    CASCADE\n)\n" rows_affected=0 rows_returned=0 elapsed=7.685471ms elapsed_secs=0.007685471
[backend] 2024-06-02T15:05:51.214988Z ERROR ryot: Database migration failed: Execution Error: error returned from database: non è possibile implementare il vincolo di chiave esterna "user_to_collection-fk1"
[backend] Error: There was an error running the database migrations.
[backend] BACKEND_PORT=5000 /usr/local/bin/ryot exited with code 1
--> Sending SIGTERM to other processes..
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: spawn ps ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,

that traslated to english is like
"The foreign key constraint "user_to_collection-fk1" cannot be implemented"

Thanks!

@ebiagi ebiagi changed the title [bug] - [bug] - The foreign key constraint "user_to_collection-fk1" cannot be implemented Jun 2, 2024
@IgnisDa
Copy link
Owner

IgnisDa commented Jun 2, 2024

Can you send me a dump of your database? You can join the discord (in readme) or email it to me.

@ebiagi
Copy link
Author

ebiagi commented Jun 2, 2024 via email

@IgnisDa IgnisDa closed this as completed in 03d1905 Jun 3, 2024
@IgnisDa
Copy link
Owner

IgnisDa commented Jun 3, 2024

@ebiagi @ellsclytn Released fix with v5.5.5.

@ebiagi Please keep in mind that your database is pretty big, so migrations will take a lot of time to complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants