Odonno / surrealdb-migrations

An awesome SurrealDB migration tool, with a user-friendly CLI and a versatile Rust library that enables seamless integration into any project.
https://crates.io/crates/surrealdb-migrations
MIT License
210 stars 16 forks source link

"`sql2` is currently unstable. You need to enable the `surrealdb_unstable` flag to use it." #77

Closed NEmbgen closed 6 months ago

NEmbgen commented 6 months ago

Describe the bug When using the library with the current version of surrealdb it throws the error described above.

To Reproduce Steps to reproduce the behavior:

  1. Add the following to Cargo.toml
surrealdb = { version = "1.2.0", features = ["kv-rocksdb"] }
surrealdb-migrations = "1.2.2"
  1. Start project

Expected behavior To run through without error

Information I guess the solution to the problem is described in the error itself, but when I add surrealdb_unstable as a feature of surrealdb-migrations it can't find it.

Odonno commented 6 months ago

Hello @NEmbgen

This is indeed a problem and surrealdb_unstable feature flag is now mandatory for v1.2.x. Here is a link to the solution: https://discord.com/channels/902568124350599239/970338835990974484/1213250427487916032

You're gonna have to set rustflags.

Sorry for the inconvenience. I expect this to disappear once surrealdb v1.3.0 is released.

NEmbgen commented 6 months ago

@Odonno thanks for your answer. Sadly putting it in

[build]
rustflags = ["--cfg", "surrealdb_unstable"]

or

[target.x86_64-pc-windows-msvc]
rustflags = ["--cfg", "surrealdb_unstable"]

does not work. It seems like I will have to wait for 1.3.0. Unless I'm doing something wrong still.

Odonno commented 6 months ago

Check this file here. But it certainly should work.

https://github.com/Odonno/surrealdb-migrations/blob/main/.cargo%2Fconfig.toml#L2

hpapier commented 6 months ago

Same error here, even with the fix suggested. :)

cargo.toml

[dependencies]
tokio = { version = "1", features = ["full"] }
axum = "0.7.4"
serde = { version = "1.0", features = ["derive"] }
surrealdb = { version = "1.2.0" }
surrealdb-migrations = "1.2.2"

[build]
rustflags = ["--cfg", "surrealdb_unstable"]
rustdocflags = ["--cfg", "surrealdb_unstable"]

[net]
git-fetch-with-cli = true
Odonno commented 6 months ago

You need to put that in .cargo/config.toml file.

NEmbgen commented 6 months ago

That worked for me, thank you!

Just to add: The same problem occurs when using the install command. Not sure where to place the config on that

Odonno commented 6 months ago

Ah yes, that's frustrating too. This should work:

RUSTFLAGS='--cfg surrealdb_unstable' cargo install surrealdb-migrations