mirror of
https://github.com/simon987/nyaa.git
synced 2025-12-13 23:29:02 +00:00
Increase maximum comment size from 255 to 1024.
DB change: Change comment text field from VARCHAR(255) to mysql.TEXT
This commit is contained in:
33
migrations/versions/b79d2fcafd88_comment_text.py
Normal file
33
migrations/versions/b79d2fcafd88_comment_text.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""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)
|
||||
Reference in New Issue
Block a user