Skip to content

Commit 782fb63

Browse files
committed
Fix DB conversion scripts
1 parent f403e19 commit 782fb63

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

database/src/bin/postgres-to-sqlite.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ impl Table for PstatSeries {
246246
}
247247

248248
fn postgres_select_statement(&self, _since_weeks_ago: Option<u32>) -> String {
249-
"select id, crate, profile, cache, statistic from ".to_string() + self.name()
249+
"select id, crate, profile, scenario, backend, metric from ".to_string() + self.name()
250250
}
251251

252252
fn sqlite_insert_statement(&self) -> &'static str {
253-
"insert into pstat_series (id, crate, profile, cache, statistic) VALUES (?, ?, ?, ?, ?)"
253+
"insert into pstat_series (id, crate, profile, scenario, backend, metric) VALUES (?, ?, ?, ?, ?, ?)"
254254
}
255255

256256
fn sqlite_execute_insert(&self, statement: &mut rusqlite::Statement, row: tokio_postgres::Row) {
@@ -261,6 +261,7 @@ impl Table for PstatSeries {
261261
row.get::<_, &str>(2),
262262
row.get::<_, &str>(3),
263263
row.get::<_, &str>(4),
264+
row.get::<_, &str>(5),
264265
])
265266
.unwrap();
266267
}

database/src/bin/sqlite-to-postgres.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,9 @@ struct PstatSeriesRow<'a> {
289289
id: i32,
290290
krate: &'a str,
291291
profile: &'a str,
292-
cache: &'a str,
293-
statistic: &'a str,
292+
scenario: &'a str,
293+
backend: &'a str,
294+
metric: &'a str,
294295
}
295296

296297
impl Table for PstatSeries {
@@ -299,7 +300,7 @@ impl Table for PstatSeries {
299300
}
300301

301302
fn sqlite_attributes() -> &'static str {
302-
"id, crate, profile, cache, statistic"
303+
"id, crate, profile, scenario, backend, metric"
303304
}
304305

305306
fn postgres_generated_id_attribute() -> Option<&'static str> {
@@ -312,8 +313,9 @@ impl Table for PstatSeries {
312313
id: row.get(0).unwrap(),
313314
krate: row.get_ref(1).unwrap().as_str().unwrap(),
314315
profile: row.get_ref(2).unwrap().as_str().unwrap(),
315-
cache: row.get_ref(3).unwrap().as_str().unwrap(),
316-
statistic: row.get_ref(4).unwrap().as_str().unwrap(),
316+
scenario: row.get_ref(3).unwrap().as_str().unwrap(),
317+
backend: row.get_ref(4).unwrap().as_str().unwrap(),
318+
metric: row.get_ref(5).unwrap().as_str().unwrap(),
317319
})
318320
.unwrap();
319321
}

0 commit comments

Comments
 (0)