Remove ipx copy-db (#85)
It was the one-off copy from SQLite to Postgres (#18), run once on 2026-09-18. Production has run on Postgres since; rolling back needs only the old state.db, which is kept, not this command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
27
src/main.rs
27
src/main.rs
@@ -38,12 +38,6 @@ struct Cli {
|
||||
enum Command {
|
||||
/// Show configured feeds and their state
|
||||
List,
|
||||
/// Copy everything from a SQLite state.db into the database IPX_DATABASE_URL names, which
|
||||
/// must be empty: the one-off move to Postgres
|
||||
CopyDb {
|
||||
/// The SQLite file to copy from
|
||||
from: PathBuf,
|
||||
},
|
||||
/// Scan feeds for new entries
|
||||
Fetch {
|
||||
/// Only this feed id
|
||||
@@ -236,8 +230,7 @@ async fn main() -> Result<()> {
|
||||
| Command::Add { .. }
|
||||
| Command::Rm { .. }
|
||||
| Command::Import { .. }
|
||||
| Command::Export { .. }
|
||||
| Command::CopyDb { .. } => None,
|
||||
| Command::Export { .. } => None,
|
||||
};
|
||||
if let Some(cmd) = &wire_cmd
|
||||
&& !cli.local
|
||||
@@ -246,13 +239,7 @@ async fn main() -> Result<()> {
|
||||
return ipc::proxy(&cfg.general.socket, cmd).await;
|
||||
}
|
||||
|
||||
// copy-db fills an empty database from another, configuration included; taking config.toml
|
||||
// into it first would have the copy collide with it.
|
||||
let cfg = if matches!(cli.command, Command::CopyDb { .. }) {
|
||||
cfg
|
||||
} else {
|
||||
assemble_config(&db, cfg, &config_path).await?
|
||||
};
|
||||
let cfg = assemble_config(&db, cfg, &config_path).await?;
|
||||
|
||||
let is_daemon = matches!(cli.command, Command::Daemon { .. });
|
||||
let (events, _) = broadcast::channel(1024);
|
||||
@@ -279,7 +266,6 @@ async fn main() -> Result<()> {
|
||||
Command::User { cmd } => user_cmd(&ctx, cmd).await,
|
||||
Command::Import { file } => import(&ctx, &file).await,
|
||||
Command::Export { file } => export(&ctx, &file).await,
|
||||
Command::CopyDb { from } => copy_db(&ctx, &from).await,
|
||||
_ => run(&ctx, wire_cmd.expect("only List and Daemon have no wire form")).await,
|
||||
};
|
||||
// The batch exporter holds the last few seconds of spans; without this they are lost.
|
||||
@@ -871,15 +857,6 @@ async fn assemble_config(db: &db::Db, mut cfg: config::Config, path: &std::path:
|
||||
anyhow::bail!("the database says it holds the configuration and then that it does not")
|
||||
}
|
||||
|
||||
async fn copy_db(ctx: &Ctx, from: &std::path::Path) -> Result<()> {
|
||||
anyhow::ensure!(from.exists(), "{} does not exist", from.display());
|
||||
let source = db::Db::open(&from.display().to_string()).await?;
|
||||
for (table, n) in ctx.db.copy_from(&source).await? {
|
||||
println!("{table:14} {n}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn export(ctx: &Ctx, file: &std::path::Path) -> Result<()> {
|
||||
let mut doc = opml::OPML::default();
|
||||
doc.head = Some(opml::Head {
|
||||
|
||||
Reference in New Issue
Block a user