Add generated database entity, just recipe and fix config table missing PK

This commit is contained in:
GW_MC
2025-11-13 20:13:05 +08:00
parent 7a1617e1ee
commit 25c0756e70
9 changed files with 96 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
set dotenv-load := true
set dotenv-filename := "./public/database/.env.generated"
simulate *args:
cd apps/container && \
if [ -n "{{args}}" ]; then \
@@ -5,3 +8,32 @@ simulate *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:
# 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