1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-11-14 06:29:16 +00:00
nyaa/migrations/versions/b79d2fcafd88_comment_text.py
nyaadev d5b8a3a2ae Increase maximum comment size from 255 to 1024.
DB change: Change comment text field from VARCHAR(255) to mysql.TEXT
2017-08-14 19:08:36 +02:00

34 lines
1 KiB
Python

"""Change comment text field from VARCHAR(255) to mysql.TEXT
Revision ID: b79d2fcafd88
Revises: ffd23e570f92
Create Date: 2017-08-14 18:57:44.165168
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'b79d2fcafd88'
down_revision = 'ffd23e570f92'
branch_labels = None
depends_on = None
TABLE_PREFIXES = ('nyaa', 'sukebei')
def upgrade():
for prefix in TABLE_PREFIXES:
op.alter_column(prefix + '_comments', 'text',
existing_type=mysql.VARCHAR(charset='utf8mb4', collation='utf8mb4_bin', length=255),
type_=mysql.TEXT(collation='utf8mb4_bin'),
existing_nullable=False)
def downgrade():
for prefix in TABLE_PREFIXES:
op.alter_column(prefix + '_comments', 'text',
existing_type=mysql.TEXT(collation='utf8mb4_bin'),
type_=mysql.VARCHAR(charset='utf8mb4', collation='utf8mb4_bin', length=255),
existing_nullable=False)