Draft
This commit is contained in:
		
							parent
							
								
									0abe31abf0
								
							
						
					
					
						commit
						371eb7e8b3
					
				
					 7 changed files with 140 additions and 9 deletions
				
			
		
							
								
								
									
										22
									
								
								makefile
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								makefile
									
										
									
									
									
								
							|  | @ -1,14 +1,20 @@ | |||
| DB_NAME := lab.db | ||||
| SQL_FILES := 001.sql 002.sql | ||||
| DB_FILE := db.sqlite | ||||
| SCRIPTS_DIR := scripts | ||||
| SQL_SCRIPTS := $(wildcard $(SCRIPTS_DIR)/*.sql) | ||||
| 
 | ||||
| .PHONY: all clean | ||||
| 
 | ||||
| all: $(SQL_FILES:.sql=.db) | ||||
| all: $(DB_FILE) | ||||
| 
 | ||||
| %.db: %.sql | ||||
| 	sqlite3 $(DB_NAME) < $< | ||||
| 	@echo ============================== | ||||
| $(DB_FILE): $(SQL_SCRIPTS) | ||||
| 	@echo "Creating database: $@" | ||||
| 	@for script in $^; do \
 | ||||
| 		echo "Running script: $$script"; \
 | ||||
| 		sqlite3 $@ < $$script; \
 | ||||
| 	done | ||||
| 	@echo "Database creation completed." | ||||
| 
 | ||||
| clean: | ||||
| 	rm -f $(DB_NAME) | ||||
| 
 | ||||
| 	@echo "Cleaning up" | ||||
| 	@rm -f $(DB_FILE) | ||||
| 	@echo "Cleanup completed." | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus