PCv5/migrations/versions/2dbb614a7236_remove_thread_table.py
Lephe 8a0ba309e0
forum: restructure models and add topic creation
This changes fixes #25 by restructuring the forum models in a way
compatible with the polymorphic behavior of SQLAlchemy. Incidentally,
the new form turns out to be more appropriate for our use than the
polymorphic one originally used.

The migration for this task is non-trivial because the Thread class was
created with a foreign-key id which thus had no auto-increment or
associated sequence. The most reliable way of getting it back was to
recreate the table because SQLAlchemy ony performs automated sequence
introduction at table creation time. Four separate migration files
perform the whole change.

This commit also adds views and forms to create topics, and the
boilerplate for an advanced markup editor that can be used as a widget.
2019-09-09 08:11:38 +02:00

33 lines
859 B
Python

"""Remove Thread table
Revision ID: 2dbb614a7236
Revises: b890d9bb207b
Create Date: 2019-09-08 12:32:58.869143
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2dbb614a7236'
down_revision = 'b890d9bb207b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('thread')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('thread',
sa.Column('top_comment_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['top_comment_id'], ['comment.id'], name='thread_top_comment_id_fkey')
)
# ### end Alembic commands ###