Fix migrations path and fmt
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				/ build-artifacts (arm-unknown-linux-gnueabihf) (push) Failing after 9m27s
				
					
					
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	/ build-artifacts (arm-unknown-linux-gnueabihf) (push) Failing after 9m27s
				This commit is contained in:
		
							parent
							
								
									96a64cf90d
								
							
						
					
					
						commit
						f539c47e3b
					
				
					 8 changed files with 1 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -17,7 +17,6 @@ pub struct DbMacro {
 | 
			
		|||
	pub name: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
impl DbMacro {
 | 
			
		||||
	pub async fn get_all(conn: &mut PoolConnection<Sqlite>) -> Result<Vec<DbMacro>, DatabaseError> {
 | 
			
		||||
		sqlx::query_as!(DbMacro, "SELECT * FROM macros")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,6 @@ pub struct DbMacroAction {
 | 
			
		|||
	pub weekday: i64, // should be u8, but sqlite will store it as i64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
impl DbMacroAction {
 | 
			
		||||
	pub async fn get_all(
 | 
			
		||||
		conn: &mut PoolConnection<Sqlite>,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ pub use tag::DbTag;
 | 
			
		|||
 | 
			
		||||
use crate::errors::{DatabaseError, EmgauwaError};
 | 
			
		||||
 | 
			
		||||
static MIGRATOR: Migrator = sqlx::migrate!("../migrations"); // defaults to "./migrations"
 | 
			
		||||
static MIGRATOR: Migrator = sqlx::migrate!(); // defaults to "./migrations"
 | 
			
		||||
 | 
			
		||||
pub async fn run_migrations(pool: &Pool<Sqlite>) -> Result<(), EmgauwaError> {
 | 
			
		||||
	log::info!("Running migrations");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@ pub struct DbRelay {
 | 
			
		|||
	pub controller_id: i64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
impl DbRelay {
 | 
			
		||||
	pub async fn get_all(conn: &mut PoolConnection<Sqlite>) -> Result<Vec<DbRelay>, DatabaseError> {
 | 
			
		||||
		sqlx::query_as!(DbRelay, "SELECT * FROM relays")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,6 @@ pub struct Macro {
 | 
			
		|||
	pub actions: Vec<MacroAction>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
impl FromDbModel for Macro {
 | 
			
		||||
	type DbModel = DbMacro;
 | 
			
		||||
	type DbModelCache = ();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,6 @@ pub struct MacroAction {
 | 
			
		|||
	pub weekday: i64,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
impl FromDbModel for MacroAction {
 | 
			
		||||
	type DbModel = DbMacroAction;
 | 
			
		||||
	type DbModelCache = ();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,6 @@ pub struct Relay {
 | 
			
		|||
	pub pulsing: Option<Instant>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
impl FromDbModel for Relay {
 | 
			
		||||
	type DbModel = DbRelay;
 | 
			
		||||
	type DbModelCache = DbController;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,6 @@ use crate::errors::EmgauwaError;
 | 
			
		|||
use crate::settings::Permissions;
 | 
			
		||||
use crate::types::{RelayStates, Weekday};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
pub fn init_logging(level: &str) -> Result<(), EmgauwaError> {
 | 
			
		||||
	let log_level: LevelFilter = LevelFilter::from_str(level)
 | 
			
		||||
		.map_err(|_| EmgauwaError::Other(format!("Invalid log level: {}", level)))?;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue