mirror of
https://github.com/open-webui/open-webui
synced 2024-12-25 05:12:16 +00:00
.. | ||
001_initial_schema.py | ||
002_add_local_sharing.py | ||
003_add_auth_api_key.py | ||
004_add_archived.py | ||
005_add_updated_at.py | ||
006_migrate_timestamps_and_charfields.py | ||
007_add_user_last_active_at.py | ||
008_add_memory.py | ||
009_add_models.py | ||
010_migrate_modelfiles_to_models.py | ||
011_add_user_settings.py | ||
012_add_tools.py | ||
013_add_user_info.py | ||
014_add_files.py | ||
015_add_functions.py | ||
016_add_valves_and_is_active.py | ||
017_add_user_oauth_sub.py | ||
018_add_function_is_global.py | ||
README.md |
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
backend
directory, 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_DB
should be the path to the database file.$MIGRATION_NAME
should be a descriptive name for the migration.
- The migration file will be created in the
apps/web/internal/migrations
directory.