mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-23 01:39:59 +00:00
6c80557e39
with a helper function on Torrent to update the count.
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
"""Add comment_count to Torrent
|
|
|
|
Revision ID: 2bceb2cb4d7c
|
|
Revises: d0eeb8049623
|
|
Create Date: 2017-05-26 15:07:21.114331
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '2bceb2cb4d7c'
|
|
down_revision = 'd0eeb8049623'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('nyaa_torrents', sa.Column('comment_count', sa.Integer(), nullable=False))
|
|
op.create_index(op.f('ix_nyaa_torrents_comment_count'), 'nyaa_torrents', ['comment_count'], unique=False)
|
|
|
|
try:
|
|
op.add_column('sukebei_torrents', sa.Column('comment_count', sa.Integer(), nullable=False))
|
|
op.create_index(op.f('ix_sukebei_torrents_comment_count'), 'sukebei_torrents', ['comment_count'], unique=False)
|
|
except (sa.exc.OperationalError, sa.exc.ProgrammingError):
|
|
print('Could not upgrade sukebei!')
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_nyaa_torrents_comment_count'), table_name='nyaa_torrents')
|
|
op.drop_column('nyaa_torrents', 'comment_count')
|
|
|
|
try:
|
|
op.drop_index(op.f('ix_sukebei_torrents_comment_count'), table_name='sukebei_torrents')
|
|
op.drop_column('sukebei_torrents', 'comment_count')
|
|
except (sa.exc.OperationalError, sa.exc.ProgrammingError):
|
|
print('Could not downgrade sukebei!')
|
|
|
|
# ### end Alembic commands ###
|