|
Download backend/apps/webui/internal/migrations/README.md from YYapi/ai: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/YYapi/ai/resolve/main/backend/apps/webui/internal/migrations/README.md
- Command line
-
hf download hf://spaces/YYapi/ai/backend/apps/webui/internal/migrations/README.md
-
curl -L -o README.md https://huggingface.co/spaces/YYapi/ai/resolve/main/backend/apps/webui/internal/migrations/README.md
1.02 kB
Database Migrations
This directory contains all the database migrations for the web app.
Migrations are done using the peewee-migrate library.
Migrations are automatically ran at app startup.
Creating a migration
Have you made a change to the schema of an existing model? You will need to create a migration file to ensure that existing databases are updated for backwards compatibility.
- Have a database file (
webui.db) that has the old schema prior to any of your changes. - Make your changes to the models.
- From the
backenddirectory, run the following command:pw_migrate create --auto --auto-source apps.webui.models --database sqlite:///${SQLITE_DB} --directory apps/web/internal/migrations ${MIGRATION_NAME}$SQLITE_DBshould be the path to the database file.$MIGRATION_NAMEshould be a descriptive name for the migration.
- The migration file will be created in the
apps/web/internal/migrationsdirectory.