Files
YANPM/justfile
GW_MC 829c4ef3e3 Add CLI application with database migration and entity generation commands
- Introduced a new CLI application in the `apps/cli` directory.
- Implemented commands for database migration and entity generation.
- Updated `Cargo.toml` files to include necessary dependencies.
- Enhanced the `justfile` to facilitate CLI command execution.
- Modified workspace configuration to include the new CLI application.
2025-11-13 21:26:31 +08:00

43 lines
1.2 KiB
Makefile

set dotenv-load := true
# development environment file
set dotenv-filename := "./public/database/.env.generated"
cli *args:
cd apps/cli && \
if [ -n "{{args}}" ]; then \
cargo run -- {{args}}; \
else \
cargo run; \
fi
simulate *args:
cd apps/container && \
if [ -n "{{args}}" ]; then \
cargo run --bin container-simulate -- --db-type={{args}}; \
else \
cargo run --bin container-simulate; \
fi
# Usage: (following SeaORM migration commands)
# init: Initialize migration directory
# generate: Generate a new migration file
# up: Apply all pending migrations
# up -n 10: Apply 10 pending migrations
# down: Rollback last applied migration
# down -n 10: Rollback last 10 applied migrations
# status: Check the status of all migrations
# fresh: Drop all tables from the database, then reapply all migrations
# refresh: Rollback all applied migrations, then reapply all migrations
# reset: Rollback all applied migrations
migrate *args:
cd public/migration && \
if [ -n "{{args}}" ]; then \
cargo run -- {{args}}; \
else \
cargo run; \
fi
generate-entity:
# delegate to cli
just cli db:migrate_and_generate --output-path ../../public/database/src/generated/entities