Automated Action 355d2a84d5 Implement notes management platform with FastAPI and SQLite
- Set up project structure with FastAPI
- Create database models for notes
- Implement Alembic migrations
- Create API endpoints for note CRUD operations
- Implement note export functionality (markdown, txt, pdf)
- Add health endpoint
- Set up linting with Ruff
2025-06-04 08:13:43 +00:00

44 lines
1.2 KiB
Python

"""initial migration - create notes table
Revision ID: 001
Revises:
Create Date: 2023-11-01
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '001'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# Create notes table
op.create_table(
'notes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('content', sa.Text(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True),
server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
sa.Column('updated_at', sa.DateTime(timezone=True),
server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False),
sa.PrimaryKeyConstraint('id')
)
# Create index on title for faster lookups
op.create_index(op.f('ix_notes_id'), 'notes', ['id'], unique=False)
op.create_index(op.f('ix_notes_title'), 'notes', ['title'], unique=False)
def downgrade() -> None:
# Drop indexes
op.drop_index(op.f('ix_notes_title'), table_name='notes')
op.drop_index(op.f('ix_notes_id'), table_name='notes')
# Drop table
op.drop_table('notes')