Skip to content

Commit 9e81127

Browse files
committed
remove check
Signed-off-by: Somtochi Onyekwere <[email protected]>
1 parent df7034e commit 9e81127

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

core/rs/core/src/db_version.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,7 @@ pub fn insert_db_version(
215215
}
216216

217217
// ensure the site_id exists in the crsql_site_id table
218-
let ordinal = get_or_set_site_ordinal(ext_data, insert_site_id)?;
219-
if ordinal == 0 {
220-
// we manage our own db_version internally.
221-
return Err(ResultCode::ERROR);
222-
}
218+
let _ = get_or_set_site_ordinal(ext_data, insert_site_id)?;
223219

224220
let bind_result = (*ext_data)
225221
.pSetDbVersionStmt
@@ -252,10 +248,11 @@ pub unsafe fn get_or_set_site_ordinal(
252248
ext_data: *mut crsql_ExtData,
253249
site_id: &[u8],
254250
) -> Result<i64, ResultCode> {
255-
let bind_result =
256-
(*ext_data)
257-
.pSelectSiteIdOrdinalStmt
258-
.bind_blob(1, site_id, sqlite::Destructor::STATIC);
251+
let bind_result = (*ext_data).pSelectSiteIdOrdinalStmt.bind_blob(
252+
1,
253+
site_id,
254+
sqlite::Destructor::STATIC,
255+
);
259256

260257
if let Err(rc) = bind_result {
261258
reset_cached_stmt((*ext_data).pSelectSiteIdOrdinalStmt)?;
@@ -272,10 +269,11 @@ pub unsafe fn get_or_set_site_ordinal(
272269
reset_cached_stmt((*ext_data).pSelectSiteIdOrdinalStmt)?;
273270
// site id had no ordinal yet.
274271
// set one and return the ordinal.
275-
let bind_result =
276-
(*ext_data)
277-
.pSetSiteIdOrdinalStmt
278-
.bind_blob(1, site_id, sqlite::Destructor::STATIC);
272+
let bind_result = (*ext_data).pSetSiteIdOrdinalStmt.bind_blob(
273+
1,
274+
site_id,
275+
sqlite::Destructor::STATIC,
276+
);
279277

280278
if let Err(rc) = bind_result {
281279
reset_cached_stmt((*ext_data).pSetSiteIdOrdinalStmt)?;
@@ -303,4 +301,4 @@ pub unsafe fn get_or_set_site_ordinal(
303301
return Err(rc);
304302
}
305303
}
306-
}
304+
}

0 commit comments

Comments
 (0)