Allow uploading of files and folders.

This commit is contained in:
2025-07-28 11:07:40 +02:00
committed by Jens Luedicke
parent 87471e033e
commit f98e8f3e71
13 changed files with 2805 additions and 8 deletions

View File

@@ -0,0 +1,45 @@
"""Add file-based note support fields
Revision ID: 275ef106dc91
Revises: 85d490db548b
Create Date: 2025-07-18 15:30:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '275ef106dc91'
down_revision = '85d490db548b'
branch_labels = None
depends_on = None
def upgrade():
# Add file-based note support columns to note table
with op.batch_alter_table('note', schema=None) as batch_op:
batch_op.add_column(sa.Column('is_file_based', sa.Boolean(), nullable=True, default=False))
batch_op.add_column(sa.Column('file_path', sa.String(length=500), nullable=True))
batch_op.add_column(sa.Column('file_type', sa.String(length=20), nullable=True))
batch_op.add_column(sa.Column('original_filename', sa.String(length=255), nullable=True))
batch_op.add_column(sa.Column('file_size', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('mime_type', sa.String(length=100), nullable=True))
batch_op.add_column(sa.Column('image_width', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('image_height', sa.Integer(), nullable=True))
# Set default value for existing records
op.execute("UPDATE note SET is_file_based = FALSE WHERE is_file_based IS NULL")
def downgrade():
# Remove file-based note support columns from note table
with op.batch_alter_table('note', schema=None) as batch_op:
batch_op.drop_column('image_height')
batch_op.drop_column('image_width')
batch_op.drop_column('mime_type')
batch_op.drop_column('file_size')
batch_op.drop_column('original_filename')
batch_op.drop_column('file_type')
batch_op.drop_column('file_path')
batch_op.drop_column('is_file_based')

View File

@@ -0,0 +1,31 @@
"""Add note preview font preference
Revision ID: 4a5b2c7d9e3f
Revises: 275ef106dc91
Create Date: 2024-07-18 13:30:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4a5b2c7d9e3f'
down_revision = '275ef106dc91'
branch_labels = None
depends_on = None
def upgrade():
# Add note_preview_font column to user_preferences table
with op.batch_alter_table('user_preferences', schema=None) as batch_op:
batch_op.add_column(sa.Column('note_preview_font', sa.String(length=50), nullable=True))
# Set default value for existing rows
op.execute("UPDATE user_preferences SET note_preview_font = 'system' WHERE note_preview_font IS NULL")
def downgrade():
# Remove note_preview_font column from user_preferences table
with op.batch_alter_table('user_preferences', schema=None) as batch_op:
batch_op.drop_column('note_preview_font')