PCv5/migrations/versions/6498631e62c5_ajout_des_clas...

55 lines
1.7 KiB
Python

"""ajout des classes Comment Thread Forum
Revision ID: 6498631e62c5
Revises: f3f6d7f7fa81
Create Date: 2019-08-21 16:47:15.557948
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6498631e62c5'
down_revision = 'f3f6d7f7fa81'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('forum',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Unicode(length=64), nullable=True),
sa.Column('slug', sa.Unicode(length=64), nullable=True),
sa.Column('description', sa.UnicodeText(), nullable=True),
sa.Column('parent_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['parent_id'], ['forum.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('thread',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('thread_type', sa.String(length=20), nullable=True),
sa.Column('title', sa.Unicode(length=32), nullable=True),
sa.Column('top_comment', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['id'], ['post.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('comment',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('text', sa.UnicodeText(), nullable=True),
sa.Column('thread_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['id'], ['post.id'], ),
sa.ForeignKeyConstraint(['thread_id'], ['thread.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('comment')
op.drop_table('thread')
op.drop_table('forum')
# ### end Alembic commands ###