Split out database stuff into sprinklers_database
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							parent
							
								
									3b96f2019d
								
							
						
					
					
						commit
						ffef2eb50c
					
				| @ -2,5 +2,6 @@ | |||||||
| 
 | 
 | ||||||
| members = [ | members = [ | ||||||
|     "sprinklers_core", |     "sprinklers_core", | ||||||
|  |     "sprinklers_database", | ||||||
|     "sprinklers_rs" |     "sprinklers_rs" | ||||||
| ] | ] | ||||||
							
								
								
									
										16
									
								
								sprinklers_database/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								sprinklers_database/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | [package] | ||||||
|  | name = "sprinklers_database" | ||||||
|  | version = "0.1.0" | ||||||
|  | authors = ["Alex Mikhalev <alexmikhalevalex@gmail.com>"] | ||||||
|  | edition = "2018" | ||||||
|  | 
 | ||||||
|  | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||||||
|  | 
 | ||||||
|  | [dependencies] | ||||||
|  | sprinklers_core = { path = "../sprinklers_core" } | ||||||
|  | rusqlite = "0.24.0" | ||||||
|  | eyre = "0.6.0" | ||||||
|  | serde = { version = "1.0.116" } | ||||||
|  | serde_json = "1.0.57" | ||||||
|  | thiserror = "1.0.20" | ||||||
|  | tracing = { version = "0.1.19" } | ||||||
| @ -18,7 +18,7 @@ if [[ -z "$MIGRATION_NAME" ]]; then | |||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| MIGRATIONS_DIR="$PROJECT_ROOT/src/database/migrations" | MIGRATIONS_DIR="$PROJECT_ROOT/sprinklers_database/src/migrations" | ||||||
| 
 | 
 | ||||||
| # echo "MIGRATIONS_DIR: $MIGRATIONS_DIR" | # echo "MIGRATIONS_DIR: $MIGRATIONS_DIR" | ||||||
| 
 | 
 | ||||||
| @ -59,7 +59,7 @@ done | |||||||
| 
 | 
 | ||||||
| LINE_TO_INSERT="\ \ \ \ migs.add(include_file_migration!($NEXT_MIGRATION, \"$NEXT_MIGRATION_PREFIX-$MIGRATION_NAME\"));" | LINE_TO_INSERT="\ \ \ \ migs.add(include_file_migration!($NEXT_MIGRATION, \"$NEXT_MIGRATION_PREFIX-$MIGRATION_NAME\"));" | ||||||
| 
 | 
 | ||||||
| MIGRATIONS_RS="$PROJECT_ROOT/src/database/migrations/mod.rs" | MIGRATIONS_RS="$PROJECT_ROOT/sprinklers_database/src/migrations/mod.rs" | ||||||
| echo "Inserting line in $MIGRATIONS_RS" | echo "Inserting line in $MIGRATIONS_RS" | ||||||
| sed -i "/INSERT MIGRATION ABOVE/i \ | sed -i "/INSERT MIGRATION ABOVE/i \ | ||||||
| $LINE_TO_INSERT" "$MIGRATIONS_RS" | $LINE_TO_INSERT" "$MIGRATIONS_RS" | ||||||
| @ -116,11 +116,17 @@ pub struct Migrations { | |||||||
|     migrations: BTreeMap<MigrationVersion, Box<dyn Migration>>, |     migrations: BTreeMap<MigrationVersion, Box<dyn Migration>>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | impl Default for Migrations { | ||||||
|  |     fn default() -> Self { | ||||||
|  |         Self { | ||||||
|  |             migrations: BTreeMap::default(), | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| impl Migrations { | impl Migrations { | ||||||
|     pub fn new() -> Self { |     pub fn new() -> Self { | ||||||
|         Self { |         Self::default() | ||||||
|             migrations: BTreeMap::new(), |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub fn add(&mut self, migration: Box<dyn Migration>) { |     pub fn add(&mut self, migration: Box<dyn Migration>) { | ||||||
| @ -8,7 +8,7 @@ edition = "2018" | |||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
| sprinklers_core = { path = "../sprinklers_core" } | sprinklers_core = { path = "../sprinklers_core" } | ||||||
| rusqlite = "0.24.0" | sprinklers_database = { path = "../sprinklers_database" } | ||||||
| color-eyre = "0.5.1" | color-eyre = "0.5.1" | ||||||
| eyre = "0.6.0" | eyre = "0.6.0" | ||||||
| thiserror = "1.0.20" | thiserror = "1.0.20" | ||||||
|  | |||||||
| @ -1,7 +1,6 @@ | |||||||
| #![warn(clippy::all)] | #![warn(clippy::all)] | ||||||
| #![warn(clippy::print_stdout)] | #![warn(clippy::print_stdout)] | ||||||
| 
 | 
 | ||||||
| mod database; |  | ||||||
| mod mqtt; | mod mqtt; | ||||||
| mod option_future; | mod option_future; | ||||||
| mod program_runner; | mod program_runner; | ||||||
| @ -12,6 +11,7 @@ mod trace_listeners; | |||||||
| mod update_listener; | mod update_listener; | ||||||
| 
 | 
 | ||||||
| use sprinklers_core::section_interface::MockSectionInterface; | use sprinklers_core::section_interface::MockSectionInterface; | ||||||
|  | use sprinklers_database as database; | ||||||
| use update_listener::UpdateListener; | use update_listener::UpdateListener; | ||||||
| 
 | 
 | ||||||
| use eyre::Result; | use eyre::Result; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user