mirror of
https://github.com/TeamPiped/sponsorblock-mirror.git
synced 2024-08-14 23:57:05 +00:00
Vaccum database after import.
This commit is contained in:
parent
f997d3ef41
commit
c45118145e
1 changed files with 1 additions and 1 deletions
|
@ -72,7 +72,7 @@ fn rocket() -> Rocket<Build> {
|
||||||
println!("Importing database...");
|
println!("Importing database...");
|
||||||
// Execute a query of some kind
|
// Execute a query of some kind
|
||||||
db.run(move |c| {
|
db.run(move |c| {
|
||||||
let result = c.batch_execute("BEGIN TRANSACTION; DROP TABLE IF EXISTS \"sponsorTimesTemp\"; CREATE UNLOGGED TABLE \"sponsorTimesTemp\"(LIKE \"sponsorTimes\" INCLUDING defaults INCLUDING constraints INCLUDING indexes); COPY \"sponsorTimesTemp\" FROM '/mirror/sponsorTimes.csv' DELIMITER ',' CSV HEADER; DROP TABLE \"sponsorTimes\"; ALTER TABLE \"sponsorTimesTemp\" RENAME TO \"sponsorTimes\"; COMMIT;");
|
let result = c.batch_execute("BEGIN TRANSACTION; DROP TABLE IF EXISTS \"sponsorTimesTemp\"; CREATE UNLOGGED TABLE \"sponsorTimesTemp\"(LIKE \"sponsorTimes\" INCLUDING defaults INCLUDING constraints INCLUDING indexes); COPY \"sponsorTimesTemp\" FROM '/mirror/sponsorTimes.csv' DELIMITER ',' CSV HEADER; DROP TABLE \"sponsorTimes\"; ALTER TABLE \"sponsorTimesTemp\" RENAME TO \"sponsorTimes\"; COMMIT; VACUUM \"sponsorTimes\";");
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
eprintln!("Failed to import database: {}", result.err().unwrap());
|
eprintln!("Failed to import database: {}", result.err().unwrap());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue