feat: Implement database migration framework with initial migrations for organizations, workspaces, agents, virtual hosts, upstreams, certificates, and users
This commit is contained in:
52
justfile
52
justfile
@@ -102,8 +102,8 @@ db-migrate:
|
||||
|
||||
# Create new database migration
|
||||
db-new-migration name:
|
||||
@echo "📝 Creating new migration: {{name}}"
|
||||
sea-orm-cli migrate generate {{name}}
|
||||
@echo "📝 Creating new migration: {{ name }}"
|
||||
sea-orm-cli migrate generate {{ name }}
|
||||
|
||||
# Reset database (drop and recreate)
|
||||
db-reset:
|
||||
@@ -115,6 +115,17 @@ db-console:
|
||||
@echo "🐘 Connecting to PostgreSQL..."
|
||||
psql $DATABASE_URL
|
||||
|
||||
# Generate SeaORM entities from database schema
|
||||
db-generate:
|
||||
@echo "⚙️ Generating SeaORM entities from database..."
|
||||
sea-orm-cli generate entity \
|
||||
--database-url $DATABASE_URL \
|
||||
--output-dir crates/nxmesh-master/src/db/entities \
|
||||
--with-serde both \
|
||||
--with-copy-enums \
|
||||
--date-time-crate chrono
|
||||
@echo "✅ Entities generated at crates/nxmesh-master/src/db/entities/"
|
||||
|
||||
# =============================================================================
|
||||
# Testing Commands
|
||||
# =============================================================================
|
||||
@@ -195,9 +206,10 @@ nginx-reload:
|
||||
bash .devcontainer/scripts/nginx-reload.sh
|
||||
|
||||
# Full nginx control via shared PID namespace
|
||||
|
||||
# Usage: just nginx-ctl <reload|stop|quit|reopen|upgrade|status>
|
||||
nginx-ctl cmd="reload":
|
||||
@bash .devcontainer/scripts/nginx-ctl.sh {{cmd}}
|
||||
@bash .devcontainer/scripts/nginx-ctl.sh {{ cmd }}
|
||||
|
||||
# Quick status check
|
||||
nginx-status:
|
||||
@@ -264,3 +276,37 @@ logs:
|
||||
docs:
|
||||
@echo "📚 Generating documentation..."
|
||||
cargo doc --open 2>/dev/null || cargo doc
|
||||
|
||||
# =============================================================================
|
||||
# API Client Generation Commands
|
||||
# =============================================================================
|
||||
|
||||
# Generate OpenAPI spec from backend (requires backend to be running)
|
||||
gen-openapi:
|
||||
@echo "📋 Generating OpenAPI spec from backend..."
|
||||
@curl -s http://localhost:8080/api/openapi.json > /tmp/openapi.json
|
||||
@echo "✅ OpenAPI spec saved to /tmp/openapi.json"
|
||||
|
||||
# Generate TypeScript API client from OpenAPI spec
|
||||
gen-api-client:
|
||||
@echo "⚡ Generating TypeScript API client..."
|
||||
@if [ ! -f /tmp/openapi.json ]; then \
|
||||
echo "❌ OpenAPI spec not found. Run 'just gen-openapi' first (backend must be running)."; \
|
||||
exit 1; \
|
||||
fi
|
||||
cd frontend && bunx openapi-typescript /tmp/openapi.json -o src/api/schema.ts
|
||||
@echo "✅ API client generated at frontend/src/api/schema.ts"
|
||||
|
||||
# Full API generation workflow (start backend, generate spec, generate client, stop backend)
|
||||
gen-api: start-backend-temp
|
||||
@just gen-openapi
|
||||
@just gen-api-client
|
||||
@echo "✅ API client generation complete!"
|
||||
|
||||
# Internal: Start backend temporarily for API generation
|
||||
start-backend-temp:
|
||||
@echo "🔧 Starting backend temporarily..."
|
||||
@cargo build --package nxmesh-master
|
||||
@cargo run --package nxmesh-master &
|
||||
@sleep 5
|
||||
@echo "✅ Backend ready"
|
||||
|
||||
Reference in New Issue
Block a user