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.
This commit is contained in:
GW_MC
2025-11-13 21:26:31 +08:00
parent 373065c95f
commit 829c4ef3e3
9 changed files with 517 additions and 13 deletions

View File

@@ -1,6 +1,15 @@
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 \
@@ -29,11 +38,5 @@ migrate *args:
fi
generate-entity:
# load development environment variables
# sea-orm-cli will also load .env file by default
cd public/migration && \
sea-orm-cli generate entity \
-o ../database/src/generated/entities \
--with-serde both \
--date-time-crate chrono
# delegate to cli
just cli db:migrate_and_generate --output-path ../../public/database/src/generated/entities