From dedb26fd5c60e089ff285fcaafa8b42f5db63b26 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 16 Oct 2024 02:53:16 -0700 Subject: [PATCH] feat: folders db migration --- .../versions/c69f45358db4_add_folder_table.py | 41 +++++++++++++++++++ src/lib/components/layout/Sidebar.svelte | 22 ++++++---- 2 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 backend/open_webui/migrations/versions/c69f45358db4_add_folder_table.py diff --git a/backend/open_webui/migrations/versions/c69f45358db4_add_folder_table.py b/backend/open_webui/migrations/versions/c69f45358db4_add_folder_table.py new file mode 100644 index 000000000..016b0d419 --- /dev/null +++ b/backend/open_webui/migrations/versions/c69f45358db4_add_folder_table.py @@ -0,0 +1,41 @@ +"""Add folder table + +Revision ID: c69f45358db4 +Revises: 3ab32c4b8f59 +Create Date: 2024-10-16 02:02:35.241684 + +""" + +from alembic import op +import sqlalchemy as sa + +revision = "c69f45358db4" +down_revision = "3ab32c4b8f59" +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + "folder", + sa.Column("id", sa.Text(), primary_key=True, nullable=False), + sa.Column("parent_id", sa.Text(), nullable=True), + sa.Column("user_id", sa.Text(), nullable=True), + sa.Column("name", sa.Text(), nullable=False), + sa.Column("items", sa.JSON(), nullable=True), + sa.Column("meta", sa.JSON(), nullable=True), + sa.Column( + "created_at", sa.DateTime(), server_default=sa.func.now(), nullable=False + ), + sa.Column( + "updated_at", + sa.DateTime(), + nullable=False, + server_default=sa.func.now(), + onupdate=sa.func.now(), + ), + ) + + +def downgrade(): + op.drop_table("folder") diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 1376539f5..ec54e0bc1 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -38,15 +38,11 @@ import DeleteConfirmDialog from '$lib/components/common/ConfirmDialog.svelte'; import Spinner from '../common/Spinner.svelte'; import Loader from '../common/Loader.svelte'; - import FilesOverlay from '../chat/MessageInput/FilesOverlay.svelte'; import AddFilesPlaceholder from '../AddFilesPlaceholder.svelte'; - import { select } from 'd3-selection'; import SearchInput from './Sidebar/SearchInput.svelte'; - import ChevronDown from '../icons/ChevronDown.svelte'; - import ChevronUp from '../icons/ChevronUp.svelte'; - import ChevronRight from '../icons/ChevronRight.svelte'; - import Collapsible from '../common/Collapsible.svelte'; import Folder from '../common/Folder.svelte'; + import Plus from '../icons/Plus.svelte'; + import Tooltip from '../common/Tooltip.svelte'; const BREAKPOINT = 768; @@ -381,7 +377,7 @@
{ @@ -425,7 +421,7 @@ + +
+