aboutsummaryrefslogtreecommitdiff
path: root/migrations/versions/9fc23495713b_.py
blob: f457ae510c7dc3d1d8a384789b11f39f05bcd73d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""empty message

Revision ID: 9fc23495713b
Revises: de004661c5e1
Create Date: 2018-07-04 00:03:20.123285

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9fc23495713b'
down_revision = 'de004661c5e1'
branch_labels = None
depends_on = None
from sqlalchemy.dialects.postgresql import ENUM

type_enum = ENUM('MOD', 'GAME', 'TXP', name='packagetype', create_type=False)

def upgrade():
    type_enum.create(op.get_bind(), checkfirst=True)

    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('krock_forum_topic')
    op.create_table('forum_topic',
    sa.Column('topic_id', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('author_id', sa.Integer(), nullable=False),
    sa.Column('type', type_enum, nullable=True),
    sa.Column('title', sa.String(length=200), nullable=False),
    sa.Column('name', sa.String(length=30), nullable=True),
    sa.Column('link', sa.String(length=200), nullable=True),
    sa.Column('posts', sa.Integer(), nullable=False),
    sa.Column('views', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('topic_id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('forum_topic')
    op.create_table('krock_forum_topic',
    sa.Column('topic_id', sa.Integer(), autoincrement=False, nullable=False),
    sa.Column('author_id', sa.Integer(), nullable=False),
    sa.Column('ttype', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=200), nullable=False),
    sa.Column('name', sa.String(length=30), nullable=True),
    sa.Column('link', sa.String(length=50), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('topic_id')
    )
    # ### end Alembic commands ###