Skip to content

Commit

Permalink
document commment
Browse files Browse the repository at this point in the history
  • Loading branch information
jiisanda committed Dec 14, 2024
1 parent 7d6c748 commit 1586073
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions migrations/versions/cb2ea87be0bd_document_comments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""document comments
Revision ID: cb2ea87be0bd
Revises: 2a02384ab925
Create Date: 2024-12-15 01:24:30.954923
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = 'cb2ea87be0bd'
down_revision: Union[str, None] = '2a02384ab925'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('document_comments',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('doc_id', sa.UUID(), nullable=True),
sa.Column('author_id', sa.String(), nullable=False),
sa.Column('comment', sa.Text(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False),
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('NOW()'), nullable=False),
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
sa.ForeignKeyConstraint(['doc_id'], ['document_metadata.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_document_comments_id'), 'document_comments', ['id'], unique=False)
op.drop_index('ix_notify_id', table_name='notify')
op.create_unique_constraint(None, 'share_url', ['url_id'])
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'share_url', type_='unique')
op.drop_index(op.f('ix_document_comments_id'), table_name='document_comments')
op.drop_table('document_comments')
# ### end Alembic commands ###

0 comments on commit 1586073

Please sign in to comment.