Skip to content

didn't work with sqlite #109

Description

@Dostonlv

thats my

[package]
name = "notes"
version = "0.1.0"
edition = "2024"

[dependencies]
anyhow = "1.0.102"
argon2 = { version = "0.5.3", features = ["std"] }
axum = { version = "0.8.9", features = ["http2", "macros"] }
dotenvy = "0.15"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.150"
sqlx = { version = "0.8", features = [
    "runtime-tokio",
    "tls-native-tls",
    "sqlite",
    "migrate",
    # "sqlx-toml",
    "json",
    "chrono",
] }
tokio = { version = "1.52.3", features = ["full", "rt-multi-thread", "macros"] }
tracing = "0.1.44"
utoipa = { version = "5", features = ["chrono"] }
chrono = { version = "0.4", features = ["serde"] }
utoipa-swagger-ui = { version = "9", features = ["axum"] }
redis = { version = "1.2.4", features = ["tokio-comp"] }
md5 = "0.8.0"
time = "0.3.51"
jsonwebtoken = { version = "10.4.0", features = ["aws_lc_rs"] } 
axum-cookie = "0.3.0"
axum-extra = {version = "0.12.6", features = ["typed-header"]}
casbin = "2.20.0"
utility-types = "0.0.4"
sqlx-adapter = { version = "1.8.0",  default-features=false, features = ["sqlite","runtime-tokio-native-tls"] }

[profile.release]
strip = true
opt-level = "z"
lto = true
codegen-units = 1

first i downgrade sqlx 0.9 to 0.8
but didn't work with sqlite project

error


[kisuke@kisuke:~/Developer/auth]$ cargo run
   Compiling sqlx-adapter v1.8.0
error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
  --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:50:5
   |
50 | /     sqlx::query!(
51 | |         "CREATE TABLE IF NOT EXISTS casbin_rule (
52 | |                     id SERIAL PRIMARY KEY,
53 | |                     ptype VARCHAR NOT NULL,
...  |
62 | |         "
63 | |     )
   | |_____^
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:119:5
    |
119 | /     sqlx::query!(
120 | |         "DELETE FROM casbin_rule WHERE
121 | |                     ptype = ?1 AND
122 | |                     v0 = ?2 AND
...   |
134 | |         rule[5]
135 | |     )
    | |_____^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:227:9
    |
227 | /         sqlx::query!(
228 | |             "DELETE FROM casbin_rule WHERE
229 | |                     ptype = ?1 AND
230 | |                     v0 = ?2 AND
...   |
242 | |             rule[5]
243 | |         )
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:413:18
    |
413 |           Box::new(sqlx::query!(
    |  __________________^
414 | |             "DELETE FROM casbin_rule WHERE
415 | |                     ptype = $1 AND
416 | |                     (v5 is NULL OR v5 = COALESCE(?2,v5))",
417 | |             pt,
418 | |             field_values[0]
419 | |         ))
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:421:18
    |
421 |           Box::new(sqlx::query!(
    |  __________________^
422 | |             "DELETE FROM casbin_rule WHERE
423 | |                     ptype = ?1 AND
424 | |                     (v4 is NULL OR v4 = COALESCE(?2,v4)) AND
...   |
428 | |             field_values[1]
429 | |         ))
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:431:18
    |
431 |           Box::new(sqlx::query!(
    |  __________________^
432 | |             "DELETE FROM casbin_rule WHERE
433 | |                     ptype = ?1 AND
434 | |                     (v3 is NULL OR v3 = COALESCE(?2,v3)) AND
...   |
440 | |             field_values[2]
441 | |         ))
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:443:18
    |
443 |           Box::new(sqlx::query!(
    |  __________________^
444 | |             "DELETE FROM casbin_rule WHERE
445 | |                     ptype = ?1 AND
446 | |                     (v2 is NULL OR v2 = COALESCE(?2,v2)) AND
...   |
454 | |             field_values[3]
455 | |         ))
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:457:18
    |
457 |           Box::new(sqlx::query!(
    |  __________________^
458 | |             "DELETE FROM casbin_rule WHERE
459 | |                     ptype = ?1 AND
460 | |                     (v1 is NULL OR v1 = COALESCE(?2,v1)) AND
...   |
470 | |             field_values[4]
471 | |         ))
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:473:18
    |
473 |           Box::new(sqlx::query!(
    |  __________________^
474 | |             "DELETE FROM casbin_rule WHERE
475 | |                     ptype = ?1 AND
476 | |                     (v0 is NULL OR v0 = COALESCE(?2,v0)) AND
...   |
488 | |             field_values[5]
489 | |         ))
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:609:40
    |
609 |       let casbin_rule: Vec<CasbinRule> = sqlx::query_as!(
    |  ________________________________________^
610 | |         CasbinRule,
611 | |         "SELECT id, ptype, v0, v1, v2, v3, v4, v5 FROM casbin_rule"
612 | |     )
    | |_____^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:663:40
    |
663 |       let casbin_rule: Vec<CasbinRule> = sqlx::query_as!(
    |  ________________________________________^
664 | |         CasbinRule,
665 | |         "SELECT id, ptype, v0, v1, v2, v3, v4, v5 from  casbin_rule WHERE (
666 | |             ptype LIKE 'g%' AND v0 LIKE $1 AND v1 LIKE $2 AND v2 LIKE $3 AND v3 LIKE $4 AND v4 LIKE $5 AND v5 LIKE $6 )
...   |
670 | |             g_filter[0], g_filter[1], g_filter[2], g_filter[3], g_filter[4], g_filter[5],
671 | |             p_filter[0], p_filter[1], p_filter[2], p_filter[3], p_filter[4], p_filter[5],)
    | |__________________________________________________________________________________________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:771:5
    |
771 |     sqlx::query!("DELETE FROM casbin_rule")
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:776:9
    |
776 | /         sqlx::query!(
777 | |             "INSERT INTO casbin_rule ( ptype, v0, v1, v2, v3, v4, v5 )
778 | |                  VALUES ( $1, $2, $3, $4, $5, $6, $7 )",
779 | |             rule.ptype,
...   |
785 | |             rule.v5
786 | |         )
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:871:5
    |
871 | /     sqlx::query!(
872 | |         "INSERT INTO casbin_rule ( ptype, v0, v1, v2, v3, v4, v5 )
873 | |                  VALUES ( $1, $2, $3, $4, $5, $6, $7 )",
874 | |         rule.ptype,
...   |
880 | |         rule.v5
881 | |     )
    | |_____^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
   --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:960:9
    |
960 | /         sqlx::query!(
961 | |             "INSERT INTO casbin_rule ( ptype, v0, v1, v2, v3, v4, v5 )
962 | |                  VALUES ( $1, $2, $3, $4, $5, $6, $7 )",
963 | |             rule.ptype,
...   |
969 | |             rule.v5
970 | |         )
    | |_________^
    |
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: found cached data for database "PostgreSQL" but no matching driver; the corresponding Cargo feature may need to be enabled
    --> /home/kisuke/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-adapter-1.8.0/src/actions.rs:1051:5
     |
1051 |     sqlx::query!("DELETE FROM casbin_rule")
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `sqlx-adapter` (lib) due to 16 previous errors

first pkg installed with caching with postgresql build caches and pls upgrade sqlx version and fix it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions