aboutsummaryrefslogtreecommitdiff
path: root/src/cli
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/make_migrations.rs4
-rw-r--r--src/cli/migrate.rs7
-rw-r--r--src/cli/mod.rs6
-rw-r--r--src/cli/run_server.rs4
4 files changed, 10 insertions, 11 deletions
diff --git a/src/cli/make_migrations.rs b/src/cli/make_migrations.rs
index b0cd341..e0653b6 100644
--- a/src/cli/make_migrations.rs
+++ b/src/cli/make_migrations.rs
@@ -7,7 +7,7 @@ use structopt::StructOpt;
use crate::db::migration::{CreateModelOption, DatabaseChange, Migration};
use crate::db::models::{Field, ModelMeta};
-use crate::{db::backend::Connectable, Settings, UrlMap};
+use crate::{Settings, UrlMap};
#[derive(StructOpt)]
/// Generate migrations
@@ -101,7 +101,7 @@ impl From<&[Migration]> for AppTablesState {
}
impl MakeMigrations {
- pub fn execute(self, _urls: UrlMap, settings: Settings<impl Connectable>) {
+ pub fn execute(self, _urls: UrlMap, settings: Settings) {
for app in settings.installed_apps {
let expected_table_state = AppTablesState::from(app.models);
let actual_table_state = AppTablesState::from(app.migrations);
diff --git a/src/cli/migrate.rs b/src/cli/migrate.rs
index acc59d3..4085fe1 100644
--- a/src/cli/migrate.rs
+++ b/src/cli/migrate.rs
@@ -1,6 +1,5 @@
use structopt::StructOpt;
-use crate::db::backend::Connectable;
use crate::db::migration::{CreateModelOption, DatabaseChange};
use crate::db::models::Field;
use crate::{Settings, UrlMap};
@@ -29,15 +28,15 @@ const CREATE_MIGRATION_TABLE: DatabaseChange = DatabaseChange::CreateModel {
};
impl Migrate {
- pub fn execute<C: Connectable>(self, _urls: UrlMap, settings: Settings<C>) {
+ pub fn execute(self, _urls: UrlMap, settings: Settings) {
let database = settings.database;
let connection = database.connect().unwrap();
- CREATE_MIGRATION_TABLE.apply::<C>("tosin_meta", &connection);
+ CREATE_MIGRATION_TABLE.apply("tosin_meta", &connection);
for app in settings.installed_apps {
for migration in app.migrations {
- migration.apply::<C>(app.name, &connection);
+ migration.apply(app.name, &connection);
}
}
}
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 5bff8ae..347430c 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -1,6 +1,6 @@
use structopt::StructOpt;
-use crate::{db::backend::Connectable, Settings, UrlMap};
+use crate::{Settings, UrlMap};
mod make_migrations;
mod migrate;
@@ -14,7 +14,7 @@ enum Command {
}
impl Command {
- fn execute(self, urls: UrlMap, settings: Settings<impl Connectable>) {
+ fn execute(self, urls: UrlMap, settings: Settings) {
match self {
Command::MakeMigrations(command) => command.execute(urls, settings),
Command::Migrate(command) => command.execute(urls, settings),
@@ -23,7 +23,7 @@ impl Command {
}
}
-pub fn main(urls: UrlMap, settings: Settings<impl Connectable>) {
+pub fn main(urls: UrlMap, settings: Settings) {
let command = Command::from_args();
command.execute(urls, settings);
}
diff --git a/src/cli/run_server.rs b/src/cli/run_server.rs
index d20ac14..242c824 100644
--- a/src/cli/run_server.rs
+++ b/src/cli/run_server.rs
@@ -1,6 +1,6 @@
use structopt::StructOpt;
-use crate::{db::backend::Connectable, Settings, UrlMap};
+use crate::{Settings, UrlMap};
#[derive(StructOpt)]
/// Run an HTTP server
@@ -11,7 +11,7 @@ pub struct RunServer {
}
impl RunServer {
- pub fn execute(self, urls: UrlMap, _settings: Settings<impl Connectable>) {
+ pub fn execute(self, urls: UrlMap, _settings: Settings) {
println!("Starting server at http://127.0.0.1:{}/", self.port);
let server_task = warp::serve(urls).run(([127, 0, 0, 1], self.port));