database.mk 600 B

12345678910111213141516171819202122232425262728
  1. .EXPORT_ALL_VARIABLES:
  2. export DB_USER=postgres
  3. export DB_PASSWORD=password
  4. export DB_NAME=flowy
  5. export DB_PORT=5433
  6. export DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}
  7. export ROOT = "./scripts/database"
  8. export DB_HOST = "localhost"
  9. init_database:
  10. ${ROOT}/init_database.sh
  11. reset_db:
  12. #diesel database reset
  13. sqlx database reset
  14. add_migrations:
  15. #make table="the name of your table" add_migrations
  16. # diesel migration generation $(table)
  17. sqlx migrate add $(table)
  18. run_migrations:
  19. # diesel migration run
  20. sqlx migrate run
  21. echo_db_url:
  22. echo ${DATABASE_URL}