mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 08:49:59 +00:00
Add Alembic migration for report tables
This commit is contained in:
parent
c2b02e252d
commit
2e4b0b1f9f
56
migrations/versions/7f064e009cab_add_report_table.py
Normal file
56
migrations/versions/7f064e009cab_add_report_table.py
Normal file
|
@ -0,0 +1,56 @@
|
|||
"""Add Report table
|
||||
|
||||
Revision ID: 7f064e009cab
|
||||
Revises: 2bceb2cb4d7c
|
||||
Create Date: 2017-05-29 16:50:28.720980
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7f064e009cab'
|
||||
down_revision = '2bceb2cb4d7c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('nyaa_reports',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_time', sa.DateTime(), nullable=True),
|
||||
sa.Column('reason', sa.String(length=255), nullable=False),
|
||||
|
||||
# sqlalchemy_utils.types.choice.ChoiceType()
|
||||
sa.Column('status', sa.Integer(), nullable=False),
|
||||
|
||||
sa.Column('torrent_id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['torrent_id'], ['nyaa_torrents.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('sukebei_reports',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_time', sa.DateTime(), nullable=True),
|
||||
sa.Column('reason', sa.String(length=255), nullable=False),
|
||||
|
||||
# sqlalchemy_utils.types.choice.ChoiceType()
|
||||
sa.Column('status', sa.Integer(), nullable=False),
|
||||
|
||||
sa.Column('torrent_id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['torrent_id'], ['sukebei_torrents.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('sukebei_reports')
|
||||
op.drop_table('nyaa_reports')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue