| 
									
										
										
										
											2021-08-19 17:26:07 +08:00
										 |  |  | .EXPORT_ALL_VARIABLES: | 
					
						
							|  |  |  | export DB_USER=postgres | 
					
						
							|  |  |  | export DB_PASSWORD=password | 
					
						
							|  |  |  | export DB_NAME=flowy | 
					
						
							|  |  |  | export DB_PORT=5433 | 
					
						
							|  |  |  | export DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME} | 
					
						
							|  |  |  | export ROOT = "./scripts/database" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-02 17:32:30 +08:00
										 |  |  | init_postgres: | 
					
						
							|  |  |  | 	${ROOT}/init_postgres.sh | 
					
						
							| 
									
										
										
										
											2021-08-19 17:26:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | init_database: | 
					
						
							| 
									
										
										
										
											2021-09-02 17:32:30 +08:00
										 |  |  | 	${ROOT}/init_database.sh | 
					
						
							| 
									
										
										
										
											2021-08-19 17:26:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | reset_db: | 
					
						
							| 
									
										
										
										
											2021-08-24 13:10:53 +08:00
										 |  |  | 	#diesel database reset | 
					
						
							| 
									
										
										
										
											2021-08-19 17:26:07 +08:00
										 |  |  | 	sqlx database reset | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | add_migrations: | 
					
						
							|  |  |  | 	#make table="the name of your table" add_migrations | 
					
						
							| 
									
										
										
										
											2021-08-24 13:10:53 +08:00
										 |  |  | 	# diesel migration generation $(table) | 
					
						
							| 
									
										
										
										
											2021-08-19 17:26:07 +08:00
										 |  |  | 	sqlx migrate add $(table) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | run_migrations: | 
					
						
							| 
									
										
										
										
											2021-08-24 13:10:53 +08:00
										 |  |  | 	# diesel migration run | 
					
						
							| 
									
										
										
										
											2021-08-19 17:26:07 +08:00
										 |  |  | 	sqlx migrate run | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo_db_url: | 
					
						
							|  |  |  | 	echo ${DATABASE_URL} | 
					
						
							|  |  |  | 
 |