mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 12:58:11 -05:00
[PR #23405] [CLOSED] feat: Add support for using mariadb for the backend database #50230
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23405
Author: @seulement55
Created: 4/4/2026
Status: ❌ Closed
Base:
dev← Head:feat/add-support-mariaDB-capabilities📝 Commits (1)
217bf40feat: Add support for using mariadb for the backend database📊 Changes
18 files changed (+361 additions, -43 deletions)
View changed files
📝
backend/open_webui/internal/db.py(+2 -2)📝
backend/open_webui/internal/migrations/007_add_user_last_active_at.py(+12 -2)📝
backend/open_webui/internal/migrations/009_add_models.py(+6 -3)📝
backend/open_webui/internal/migrations/012_add_tools.py(+5 -2)📝
backend/open_webui/internal/migrations/014_add_files.py(+5 -2)📝
backend/open_webui/internal/migrations/015_add_functions.py(+5 -2)➕
backend/open_webui/internal/utils.py(+12 -0)📝
backend/open_webui/internal/wrappers.py(+39 -2)📝
backend/open_webui/migrations/README(+11 -0)📝
backend/open_webui/migrations/env.py(+128 -0)📝
backend/open_webui/migrations/util.py(+38 -1)📝
backend/open_webui/migrations/versions/38d63c18f30f_add_oauth_session_table.py(+2 -1)📝
backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py(+7 -5)📝
backend/open_webui/migrations/versions/b10670c03dd5_update_user_table.py(+13 -6)📝
backend/open_webui/migrations/versions/c69f45358db4_add_folder_table.py(+3 -2)📝
backend/open_webui/migrations/versions/d4e5f6a7b8c9_add_automation_tables.py(+7 -5)📝
backend/open_webui/migrations/versions/f1e2d3c4b5a6_add_access_grant_table.py(+65 -7)📝
backend/requirements.txt(+1 -1)📄 Description
Pull Request Checklist
devbranch. PRs targetingmainwill be immediately closed.devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.Description
Open-WebUI currently supports SQLite and PostgreSQL as primary databases. This PR adds MariaDB as a supported primary backend database, allowing Open-WebUI to run with MariaDB for application data, migrations, and runtime persistence.
My main motivation for proposing this change is operational simplicity: Open-WebUI already supports MariaDB Vector as a vector database backend, so adding MariaDB as the primary database allows users to deploy both the main application data and vector storage on a single database system instead of operating multiple database technologies side-by-side.
For users who are already committed to MariaDB infrastructure, this means:
This PR is designed as an opt-in compatibility expansion rather than a database-layer redesign. Existing SQLite and PostgreSQL users are unaffected.
This work addresses the request to support MariaDB as a main database backend (see discussion #22803).
Scope of the change
This PR adds MariaDB support for the primary backend database by:
This PR is intentionally limited to MariaDB as the primary backend database.
Design notes
This change is intended to stay aligned with the current architecture:
DATABASE_URL.The implementation follows the same overall connection/migration pattern already used for existing primary database backends.
Dependencies
New dependency added:
mariadbPython driverRationale:
MariaDB primary DB support uses the preferred
mariadb+mariadbconnector://...URL scheme, which requires the official MariaDB Connector/Python driver.PyMySQLremains available as a compatibility fallback formysql+pymysql://....Compatibility notes:
DATABASE_URL.Manual tests
Build the Docker image from this branch:
Both test runs below used a fresh empty database before startup.
MariaDB primary DB + MariaDB vector test
Start Open-WebUI against MariaDB
There are no migration/runtime errors:
Verify migration-created tables exist
Check important indexes were created
Verify DB rows after manual actions
Screenshots
PostgesSQL primary DB + pgvector test
Start Open-WebUI against PostgesSQL
There are no migration/runtime errors:
Verify migration-created tables exist
Verify DB rows after manual actions
Screenshots
Observed outcome
Documentation
Changelog Entry
Description
Added
Changed
Additional Information
mariadb-vectoron the vector database side; this PR complements that by enabling MariaDB for the primary database as well.Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.