"""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')