vibe coded the shit out of a db migration system
This commit is contained in:
52
Makefile
52
Makefile
@@ -34,6 +34,56 @@ showenv:
|
||||
make build
|
||||
./bin/${BINARY_NAME} --showenv
|
||||
|
||||
# Database migration commands
|
||||
|
||||
# Run pending migrations (with automatic compressed backup)
|
||||
migrate:
|
||||
@echo "Running migrations with automatic backup..."
|
||||
make build
|
||||
./bin/${BINARY_NAME}${SUFFIX} --migrate
|
||||
./bin/${BINARY_NAME}${SUFFIX} --migrate-up
|
||||
|
||||
# Run migrations without backup (dev only - faster)
|
||||
migrate-no-backup:
|
||||
@echo "Running migrations WITHOUT backup (dev mode)..."
|
||||
make build
|
||||
./bin/${BINARY_NAME}${SUFFIX} --migrate-up --no-backup
|
||||
|
||||
# Rollback last migration group (with automatic backup)
|
||||
migrate-rollback:
|
||||
@echo "Rolling back last migration group..."
|
||||
make build
|
||||
./bin/${BINARY_NAME}${SUFFIX} --migrate-rollback
|
||||
|
||||
# Show migration status
|
||||
migrate-status:
|
||||
make build
|
||||
./bin/${BINARY_NAME}${SUFFIX} --migrate-status
|
||||
|
||||
# Preview migrations without applying (dry-run)
|
||||
migrate-dry-run:
|
||||
@echo "Previewing pending migrations (dry-run)..."
|
||||
make build
|
||||
./bin/${BINARY_NAME}${SUFFIX} --migrate-dry-run
|
||||
|
||||
# Create new migration (usage: make migrate-create NAME=add_email_column)
|
||||
migrate-create:
|
||||
@if [ -z "$(NAME)" ]; then \
|
||||
echo "❌ Error: NAME is required"; \
|
||||
echo ""; \
|
||||
echo "Usage: make migrate-create NAME=add_email_column"; \
|
||||
echo ""; \
|
||||
echo "Examples:"; \
|
||||
echo " make migrate-create NAME=add_games_table"; \
|
||||
echo " make migrate-create NAME=add_email_to_users"; \
|
||||
echo " make migrate-create NAME=create_index_on_username"; \
|
||||
exit 1; \
|
||||
fi
|
||||
./bin/${BINARY_NAME}${SUFFIX} --migrate-create $(NAME)
|
||||
|
||||
# Reset database (DESTRUCTIVE - dev only!)
|
||||
reset-db:
|
||||
@echo "⚠️ WARNING: This will DELETE ALL DATA!"
|
||||
make build
|
||||
./bin/${BINARY_NAME}${SUFFIX} --reset-db
|
||||
|
||||
.PHONY: migrate migrate-no-backup migrate-rollback migrate-status migrate-dry-run migrate-create reset-db
|
||||
|
||||
Reference in New Issue
Block a user