aboutsummaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMelody Horn / boringcactus <melody@boringcactus.com>2021-06-16 14:47:57 -0600
committerMelody Horn / boringcactus <melody@boringcactus.com>2021-06-16 14:47:57 -0600
commit3b880c0ae7963d783fb87a3389f98070e448495a (patch)
tree9523ad42279daa2f00c92b8c9a7d1025d68b5524 /src/bin
parent1891efa8c68424200ecf4597fc7134a289cb5b70 (diff)
downloadtosin-3b880c0ae7963d783fb87a3389f98070e448495a.tar.gz
tosin-3b880c0ae7963d783fb87a3389f98070e448495a.zip
*clears breath* extend tutorial further
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/tosin-admin.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/bin/tosin-admin.rs b/src/bin/tosin-admin.rs
index e519d50..0a359d3 100644
--- a/src/bin/tosin-admin.rs
+++ b/src/bin/tosin-admin.rs
@@ -29,10 +29,29 @@ tosin::main!(urls(), settings());
"#;
const APP_MOD: &str = r#"
+use tosin::apps::AppConfig;
+
+mod migrations;
+pub mod models;
pub mod urls;
pub mod views;
pub use urls::urls;
+
+pub const APP: AppConfig = AppConfig {
+ name: module_path!(),
+ migrations: migrations::migrations,
+};
+"#;
+const APP_MIGRATIONS: &str = r#"
+use tosin::db::migration::{Migration, gather};
+
+gather!();
+"#;
+const APP_MODELS: &str = r#"
+use tosin::db::models::{Model, Id};
+
+// TODO define models
"#;
const APP_URLS: &str = r#"
use tosin::urls::{UrlMap, url_map};
@@ -100,6 +119,9 @@ fn main() {
let app_folder = Path::new("src").join(name);
fs::create_dir(&app_folder).unwrap();
fs::write(app_folder.join("mod.rs"), APP_MOD).unwrap();
+ fs::create_dir_all(app_folder.join("migrations")).unwrap();
+ fs::write(app_folder.join("migrations/mod.rs"), APP_MIGRATIONS).unwrap();
+ fs::write(app_folder.join("models.rs"), APP_MODELS).unwrap();
fs::write(app_folder.join("urls.rs"), APP_URLS).unwrap();
fs::write(app_folder.join("views.rs"), APP_VIEWS).unwrap();
} else {