Browse Source

polls: added migration

pull/86/head
Eldeberen 8 months ago
parent
commit
169aca8304
Signed by: Darks GPG Key ID: 7515644268BE1433
  1. 48
      migrations/versions/cfb91e6aa9fc_added_polls.py

48
migrations/versions/cfb91e6aa9fc_added_polls.py

@ -0,0 +1,48 @@
"""Added polls
Revision ID: cfb91e6aa9fc
Revises: cd4868f312c5
Create Date: 2021-02-19 21:08:25.065628
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cfb91e6aa9fc'
down_revision = 'cd4868f312c5'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('poll',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('type', sa.String(length=20), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.Column('title', sa.UnicodeText(), nullable=True),
sa.Column('start', sa.DateTime(), nullable=True),
sa.Column('end', sa.DateTime(), nullable=True),
sa.Column('choices', sa.PickleType(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['member.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('pollanswer',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('poll_id', sa.Integer(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.Column('answer', sa.PickleType(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['member.id'], ),
sa.ForeignKeyConstraint(['poll_id'], ['poll.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('pollanswer')
op.drop_table('poll')
# ### end Alembic commands ###
Loading…
Cancel
Save