31 lines
931 B
Python
31 lines
931 B
Python
"""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') |