1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-23 00:30:05 +00:00
nyaa/migrations/versions/3001f79b7722_add_torrents.uploader_ip.py
TheAMM 6f9341d3f1 Add initial database state for Alembic, update existing migrations
Existing migrations will apply changes to both Nyaa and Sukebei
(adjusted manually - in the future Alembic should be able to create operations
for both, thanks to having both models loaded)

Added a down_revision for previously-earliest revision.
2017-05-27 18:14:43 +03:00

30 lines
652 B
Python

"""Add uploader_ip column to torrents table.
Revision ID: 3001f79b7722
Revises:
Create Date: 2017-05-21 18:01:35.472717
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3001f79b7722'
down_revision = '97ddefed1834'
branch_labels = None
depends_on = None
TABLE_PREFIXES = ('nyaa', 'sukebei')
def upgrade():
for prefix in TABLE_PREFIXES:
op.add_column(prefix + '_torrents', sa.Column('uploader_ip', sa.Binary(), nullable=True))
# ### end Alembic commands ###
def downgrade():
for prefix in TABLE_PREFIXES:
op.drop_column(prefix + '_torrents', 'uploader_ip')