support infinite length posts and comments (fixes #229)

This commit is contained in:
justcool393 2023-02-25 02:18:30 -08:00 committed by GitHub
parent 44919507e9
commit bfe8fb70f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 99 additions and 32 deletions

View file

@ -50,7 +50,10 @@ def run_migrations_offline():
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url, target_metadata=target_metadata, literal_binds=True
url=url, target_metadata=target_metadata, literal_binds=True,
#compare_type=True,
# compare_type is commented out here in order to make tests pass
# this should be uncommented when migrations are completely up to date
)
with context.begin_transaction():
@ -81,6 +84,7 @@ def run_migrations_online():
context.configure(
connection=connection,
target_metadata=target_metadata,
#compare_type=True,
process_revision_directives=process_revision_directives,
**current_app.extensions['migrate'].configure_args
)

View file

@ -0,0 +1,66 @@
"""support infinite length submission and comment bodies
Revision ID: 85458909736a
Revises: ba8a214736eb
Create Date: 2023-02-17 03:03:40.358958+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '85458909736a'
down_revision = 'ba8a214736eb'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('comments', 'body',
existing_type=sa.VARCHAR(length=40000),
type_=sa.Text(),
existing_nullable=True)
op.alter_column('comments', 'body_html',
existing_type=sa.VARCHAR(length=40000),
type_=sa.Text(),
nullable=False)
op.alter_column('submissions', 'body',
existing_type=sa.VARCHAR(length=40000),
type_=sa.Text(),
existing_nullable=True)
op.alter_column('submissions', 'body_html',
existing_type=sa.VARCHAR(length=40000),
type_=sa.Text(),
existing_nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('submissions', 'body_html',
existing_type=sa.Text(),
type_=sa.VARCHAR(length=40000),
existing_nullable=True)
op.alter_column('submissions', 'body',
existing_type=sa.Text(),
type_=sa.VARCHAR(length=40000),
existing_nullable=True)
op.alter_column('oauth_apps', 'redirect_uri',
existing_type=sa.String(length=50),
type_=sa.VARCHAR(length=4096),
existing_nullable=False)
op.alter_column('oauth_apps', 'client_id',
existing_type=sa.String(),
type_=sa.CHAR(length=64),
existing_nullable=True)
op.alter_column('comments', 'body_html',
existing_type=sa.Text(),
type_=sa.VARCHAR(length=40000),
nullable=True)
op.alter_column('comments', 'body',
existing_type=sa.Text(),
type_=sa.VARCHAR(length=40000),
existing_nullable=True)
# ### end Alembic commands ###