mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
fix tests and revert change in behavior when primary_key_from_op != primary_key_from_db && index.is_empty()
This commit is contained in:
parent
677d7293f5
commit
c202f3dbe2
2 changed files with 4 additions and 10 deletions
|
@ -777,15 +777,9 @@ pub fn retrieve_or_guess_primary_key<'a>(
|
|||
match primary_key_from_op {
|
||||
// we did, and it is different from the DB one
|
||||
Some(primary_key_from_op) if primary_key_from_op != primary_key_from_db => {
|
||||
// is the index empty?
|
||||
if index.number_of_documents(rtxn)? == 0 {
|
||||
// change primary key
|
||||
(primary_key_from_op, true)
|
||||
} else {
|
||||
return Ok(Err(UserError::PrimaryKeyCannotBeChanged(
|
||||
primary_key_from_db.to_string(),
|
||||
)));
|
||||
}
|
||||
return Ok(Err(UserError::PrimaryKeyCannotBeChanged(
|
||||
primary_key_from_db.to_string(),
|
||||
)));
|
||||
}
|
||||
_ => (primary_key_from_db, false),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue