# Time Tracker Backend Makefile .PHONY: db-start db-stop db-test model-test run build clean migrate seed help # Default target .DEFAULT_GOAL := help # Variables BINARY_NAME=timetracker DB_CONTAINER=timetracker_db # Help target help: @echo "Time Tracker Backend Makefile" @echo "" @echo "Usage:" @echo " make db-start - Start the PostgreSQL database container" @echo " make db-stop - Stop the PostgreSQL database container" @echo " make db-test - Test the database connection" @echo " make model-test - Test the database models" @echo " make run - Run the application" @echo " make build - Build the application" @echo " make clean - Remove build artifacts" @echo " make migrate - Run database migrations" @echo " make seed - Seed the database with initial data" @echo " make help - Show this help message" # Start the database db-start: @echo "Starting PostgreSQL database container..." @cd .. && docker-compose up -d db @echo "Database container started" # Stop the database db-stop: @echo "Stopping PostgreSQL database container..." @cd .. && docker-compose stop db @echo "Database container stopped" # Test the database connection db-test: @echo "Testing database connection..." @go run cmd/dbtest/main.go # Test the database models model-test: @echo "Testing database models..." @go run cmd/modeltest/main.go # Run the application run: @echo "Running the application..." @go run cmd/api/main.go # Build the application build: @echo "Building the application..." @go build -o $(BINARY_NAME) cmd/api/main.go @echo "Build complete: $(BINARY_NAME)" # Clean build artifacts clean: @echo "Cleaning build artifacts..." @rm -f $(BINARY_NAME) @echo "Clean complete" # Run database migrations migrate: @echo "Running database migrations..." @go run -mod=mod cmd/migrate/main.go @echo "Migrations complete" # Seed the database with initial data seed: @echo "Seeding the database..." @go run -mod=mod cmd/seed/main.go @echo "Seeding complete"