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

API SQLite Adaptor: "Sqlite does not support modification of foreign key constraints to existing tables" #296

Open
cubuzz opened this issue Jul 21, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@cubuzz
Copy link

cubuzz commented Jul 21, 2023

Description of the bug

When setting up a new installation, the following error gets thrown.

CREATE TABLE IF NOT EXISTS "person" (
  "name" text NOT NULL,
  "password_hash" text,
  "created_at" text NOT NULL,
  "availability" text NOT NULL,
  "event_id" text NOT NULL,
  PRIMARY KEY ("event_id", "name")
)
  
thread 'main' panicked at 'Sqlite does not support modification of foreign key constraints to existing tables', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-query-0.28.4/src/backend/sqlite/foreign_key.rs:34:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:67:14
   2: sea_query::backend::sqlite::foreign_key::<impl sea_query::backend::foreign_key_builder::ForeignKeyBuilder for sea_query::backend::sqlite::SqliteQueryBuilder>::prepare_foreign_key_create_statement_internal
   3: <sea_query::foreign_key::create::ForeignKeyCreateStatement as sea_orm::database::statement::StatementBuilder>::build
   4: <sql_adaptor::migration::m01_setup_tables::Migration as sea_orm_migration::MigrationTrait>::up::{{closure}}
   5: sea_orm_migration::migrator::MigratorTrait::up::{{closure}}::{{closure}}::{{closure}}
   6: sea_orm_migration::migrator::MigratorTrait::up::{{closure}}
   7: tokio::runtime::context::BlockingRegionGuard::block_on
   8: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
   9: tokio::runtime::runtime::Runtime::block_on
  10: crabfit_api::main

To reproduce

Compile the API using the sql-adaptor
Touch a new database file
Attempt to connect using SQLite to said database file

Expected behavior

Migrations pass and the API starts

Additional information

No response

@cubuzz cubuzz added the bug Something isn't working label Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant