commit - b78b84dda46392047c1c797891adff38999ecc86
commit + 7e1e64f5db5593deaefdac146e4d91fb5d16d7d7
blob - cd7812b38aa289f6da7899e9441b4b193006f3d0
blob + 2c2336a684b75dc631aafa03a7ed6bdfac663997
--- Cargo.lock
+++ Cargo.lock
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
+dependencies = [
+ "serde",
+]
[[package]]
name = "email-encoding"
"percent-encoding",
"rustls",
"rustls-pemfile",
+ "serde",
"sha2",
"smallvec",
"sqlformat",
"dotenvy",
"either",
"heck",
+ "hex",
"once_cell",
"proc-macro2",
"quote",
+ "serde",
+ "serde_json",
"sha2",
"sqlx-core",
"sqlx-rt",
blob - b8cf0dcf0c580aefaf60cb416a914e8802453619
blob + ad126db75bc8b4c31f989c8956cc270e9947084a
--- Cargo.toml
+++ Cargo.toml
log = "0.4.17"
env_logger = "0.9.0"
tokio = { version = "1.21.2", default-features = false, features = ["rt-multi-thread", "macros"] }
-sqlx = { version = "0.6.2", features = ["runtime-tokio-rustls", "sqlite"] }
+sqlx = { version = "0.6.2", features = ["runtime-tokio-rustls", "migrate", "sqlite", "offline"] }
blob - a8c711c634784e7a1f3cf4b55c4be3f9ca0fc81b (mode 644)
blob + /dev/null
--- migrations/2022-02-22-214045_create_posts/down.sql
+++ /dev/null
--- This file should undo anything in `up.sql`
-DROP TABLE posts
blob - 87c7854151cf92a4ad352f7928fdd0ee37909e7b (mode 644)
blob + /dev/null
--- migrations/2022-02-22-214045_create_posts/up.sql
+++ /dev/null
--- Your SQL goes here
-CREATE TABLE posts (
- guid TEXT PRIMARY KEY NOT NULL,
- title TEXT,
- author TEXT,
- url TEXT,
- feedurl TEXT,
- pub_date BIGINT,
- content TEXT,
- sent BOOLEAN NOT NULL DEFAULT 0
-)
blob - /dev/null
blob + b1eab722bc189f77be4945956ba7ef9f34c6188d (mode 644)
--- /dev/null
+++ migrations/20221120130636_create_posts_table.down.sql
+DROP TABLE posts
blob - /dev/null
blob + fa5e70c2498450231d92b8f201cf6ae42a1c9c65 (mode 644)
--- /dev/null
+++ migrations/20221120130636_create_posts_table.up.sql
+CREATE TABLE posts (
+ guid TEXT PRIMARY KEY NOT NULL,
+ title TEXT,
+ author TEXT,
+ url TEXT,
+ feedurl TEXT,
+ pub_date BIGINT,
+ content TEXT,
+ sent BOOLEAN NOT NULL DEFAULT 0
+)
blob - 0ac9058280a7d2d1449e892283bd7bef9aa08a2a
blob + 97d3e68e205c9872dd8f757d395bcfe9d7c53470
--- src/main.rs
+++ src/main.rs
#[tokio::main]
async fn main() -> anyhow::Result<()> {
- // TODO: migrations
- //diesel_migrations::embed_migrations!("migrations/");
env_logger::init();
let args = cli::Cli::build_app()?;
.max_connections(5)
.connect(db_path.to_str().unwrap())
.await?;
- // TODO: migrations
- //embedded_migrations::run(&conn)?;
+ sqlx::migrate!("./migrations").run(&pool).await?;
+
let mut set = JoinSet::new();
for u in urls {
set.spawn(async move { rss::fetch_new(u).await });