aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/database.rs10
3 files changed, 7 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index d6f81d2..07dc10b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1585,7 +1585,7 @@ dependencies = [
[[package]]
name = "rss-watcher"
-version = "0.1.0"
+version = "0.3.2"
dependencies = [
"chrono",
"env_logger",
diff --git a/Cargo.toml b/Cargo.toml
index e30a97c..dfbf227 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rss-watcher"
-version = "0.3.1"
+version = "0.3.2"
edition = "2021"
[dependencies]
diff --git a/src/database.rs b/src/database.rs
index 67157ae..2cd3c3f 100644
--- a/src/database.rs
+++ b/src/database.rs
@@ -98,7 +98,7 @@ fn table_create(conn: &mut Conn) {
* Select the row in the table describing the database version.
*/
fn get_db_version(conn: &mut Conn) -> i64 {
- let q = "SELECT `last_fetch` from `rss-watcher-feeds` WHERE `id`=0 AND `url` LIKE 'version'";
+ let q = "SELECT `last_fetch` from `rss-watcher-feeds` WHERE (`id`=0 OR `id`=1) AND `url` LIKE 'version'";
let res: Result<Option<i64>> = conn.query_first(q);
if let Err(x) = res {
error!("Could not get current version from database ({:#?})...", x);
@@ -106,7 +106,7 @@ fn get_db_version(conn: &mut Conn) -> i64 {
}
let res_res = res.unwrap();
if let None = res_res {
- error!("Row with id=0 and url='version' does not exist, something is wrong!");
+ error!("Row with (id=0 or id=1) and url='version' does not exist, something is wrong!");
error!("Please fix your database manually!");
process::exit(1);
}
@@ -120,7 +120,7 @@ fn run_migrations_v2(tx: &mut Transaction, version: i64) {
if version < 2 {
warn!("Running migrations to v2");
let mut q;
- q = "ALTER TABLE `rss_watcher`.`rss-watcher-feeds` \
+ q = "ALTER TABLE `rss-watcher-feeds` \
CHANGE COLUMN `title` `title` VARCHAR(255) NOT NULL DEFAULT '{{title}}: {{entry.title}}' , \
CHANGE COLUMN `message` `message` VARCHAR(255) NOT NULL DEFAULT '{{entry.summary}}';";
@@ -129,7 +129,7 @@ fn run_migrations_v2(tx: &mut Transaction, version: i64) {
process::exit(1);
}
- q = "UPDATE `rss-watcher-feeds` SET `last_fetch`=2 WHERE `id`=0";
+ q = "UPDATE `rss-watcher-feeds` SET `last_fetch`=2 WHERE (`id`=0 OR `id`=1) AND `url` LIKE 'version' ";
if let Err(x) = tx.query_drop(q) {
error!("Could not run database migration to v2...! ({:#?}", x);
process::exit(1);
@@ -190,7 +190,7 @@ pub fn get_feeds(conn: &mut Conn) -> Option<Vec<FeedConf>> {
`push_url`, \
`push_token` \
FROM `rss-watcher-feeds` \
- WHERE id > 0";
+ WHERE `url` NOT LIKE 'version'";
let res = conn.query_map(q,
|(id,url,last_fetch,title,message,push_url,push_token)| {
FeedConf{id,url,last_fetch,title,message,push_url,push_token}