diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-11 18:42:30 -0500 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-11 18:42:30 -0500 |
commit | 1be4dce20256f22d0be648fad016e819a050e95d (patch) | |
tree | d2795239360168969ceae3d7d909035277e24841 | |
parent | 32d3fa0eaea214c0c291ac6387cd4289b9cec69a (diff) |
Add embedded diesel db migrations
-rw-r--r-- | Cargo.lock | 32 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/main.rs | 6 | ||||
-rw-r--r-- | static/default.css | 5 | ||||
-rw-r--r-- | templates/profile.hbs | 4 |
5 files changed, 41 insertions, 7 deletions
@@ -303,6 +303,15 @@ dependencies = [ ] [[package]] +name = "diesel_migrations" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "migrations_macros 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "digest" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -746,6 +755,25 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "migrations_internals" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "migrations_macros" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "mime" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1059,6 +1087,7 @@ dependencies = [ "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "diesel_migrations 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "fern 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1975,6 +2004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" "checksum diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d7cc03b910de9935007861dce440881f69102aaaedfd4bc5a6f40340ca5840c" "checksum diesel_derives 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" +"checksum diesel_migrations 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dotenv 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "400b347fe65ccfbd8f545c9d9a75d04b0caf23fec49aaa838a9a05398f94c019" "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" @@ -2029,6 +2059,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +"checksum migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8089920229070f914b9ce9b07ef60e175b2b9bc2d35c3edd8bf4433604e863b9" +"checksum migrations_macros 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "719ef0bc7f531428764c9b70661c14abd50a7f3d21f355752d9985aa21251c9e" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" "checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599" @@ -12,6 +12,7 @@ clap = "2" rocket = "0.4.2" rocket_contrib = { version = "0.4.2", default-features = false, features = ["handlebars_templates", "diesel_postgres_pool", "serve"] } diesel = { version = "1.0.0", features = ["postgres", "chrono", "extras"] } +diesel_migrations = "1.4" dotenv = "0.9.0" bcrypt = "0.6" base64 = "0.11" diff --git a/src/main.rs b/src/main.rs index ec0e660..13e4cd2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,8 @@ extern crate fern; #[macro_use] extern crate log; extern crate clap; +#[macro_use] +extern crate diesel_migrations; use chrono::Utc; use clap::App; @@ -15,6 +17,8 @@ use pjournal::importer; use pjournal::models; use serde_json::to_value; +embed_migrations!(); + fn setup_logger() -> Result<(), fern::InitError> { use fern::colors::{Color, ColoredLevelConfig}; let colors = ColoredLevelConfig::new(); @@ -140,6 +144,8 @@ fn main() { let db_url = matches.value_of("database_url").unwrap(); let conn = PgConnection::establish(db_url).unwrap(); + embedded_migrations::run(&conn).unwrap(); + if let Some(matches) = matches.subcommand_matches("init") { let config = models::Config { strava_client_id: matches.value_of("strava_client_id").unwrap().to_string(), diff --git a/static/default.css b/static/default.css index 2377d14..b3003ab 100644 --- a/static/default.css +++ b/static/default.css @@ -106,13 +106,10 @@ th, td { .details-visible { padding: 8px; - max-height: 1000px; + max-height: 600px; transition: all 0.15s ease-in-out; } -.details div { -} - tr:nth-child(2n + 1) td { background-color: #fff; } diff --git a/templates/profile.hbs b/templates/profile.hbs index a1c6ed1..cd69e61 100644 --- a/templates/profile.hbs +++ b/templates/profile.hbs @@ -39,9 +39,7 @@ function toggleDetails(e) { <td>{{ this }}</td> {{/each ~}} <td class="details"> - <div> - Hello - </div> + Here are the details about this activity. </td> </tr> {{/each ~}} |