[pgvector] Something in the generated tests is trying to drop the vector
type, causing them to fail.
#1275
Unanswered
RuurdBijlsma
asked this question in
Q&A
Replies: 1 comment
-
Found out it does work on the first test on a clean db, with this info I got this workaround: #[tokio::test]
#[serial]
async fn test_model() {
configure_insta!();
let boot = boot_test::<App>().await.unwrap();
seed::<App>(&boot.app_context).await.unwrap();
helpers::teardown(&boot.app_context.db).await;
} with pub async fn teardown(db: &DatabaseConnection) {
db.execute_unprepared("DROP EXTENSION IF EXISTS vector CASCADE")
.await
.expect("Ono!");
} i have to add If anyone has more knowledge about this and has a better way to solve it I'd still love to hear it. I know there's a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm using Loco and have made a bunch of migrations to set up my database, entities, models and tests. In some of these migrations I use the vector type from pgvectors. After some figuring out it works pretty well, I just have to change the type of the generated entity from this
to this
In the playground I can use this type fine.
However, the generated tests all fail, all with the following error:
This is the line that produces the error:
First I thought this was because I wasn't dropping the vectors extension correctly in my migrations, so I made it into a separate migration that runs first, but that didn't fix it. This is my first migration:
Removing the DROP EXTENSION line doesn't change the error. Also all down migrations work correctly, I can run
cargo loco db down 17
to revert all migrations without issue.So now I have no idea how to fix it, and I'm hoping someone with deeper knowledge of what component is trying to drop the
vector
type can help. I'm new to Rust so I'm still pretty useless in solving this stuff myself.My full code is here if that helps: https://github.com/RuurdBijlsma/photos-backend/tree/develop
The full output of the failing tests is here: https://github.com/RuurdBijlsma/photos-backend/actions/runs/13484032328/job/37672868935?pr=2#step:6:2052
Beta Was this translation helpful? Give feedback.
All reactions