database.mk 613 B

123456789101112131415161718192021222324252627282930
  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. init_postgres:
  9. ${ROOT}/init_postgres.sh
  10. init_database:
  11. ${ROOT}/init_database.sh
  12. reset_db:
  13. #diesel database reset
  14. sqlx database reset
  15. add_migrations:
  16. #make table="the name of your table" add_migrations
  17. # diesel migration generation $(table)
  18. sqlx migrate add $(table)
  19. run_migrations:
  20. # diesel migration run
  21. sqlx migrate run
  22. echo_db_url:
  23. echo ${DATABASE_URL}