|
|
@ -1,8 +1,8 @@
|
|
|
|
"""empty message
|
|
|
|
"""initial scheme
|
|
|
|
|
|
|
|
|
|
|
|
Revision ID: f4e1b4727000
|
|
|
|
Revision ID: 71386dc42f9b
|
|
|
|
Revises:
|
|
|
|
Revises:
|
|
|
|
Create Date: 2020-03-09 12:32:25.827118
|
|
|
|
Create Date: 2020-03-16 00:26:18.607144
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
from alembic import op
|
|
|
@ -11,7 +11,7 @@ import sqlalchemy_utc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
revision = 'f4e1b4727000'
|
|
|
|
revision = '71386dc42f9b'
|
|
|
|
down_revision = None
|
|
|
|
down_revision = None
|
|
|
|
branch_labels = None
|
|
|
|
branch_labels = None
|
|
|
|
depends_on = None
|
|
|
|
depends_on = None
|
|
|
@ -24,7 +24,7 @@ def upgrade():
|
|
|
|
sa.Column('updated', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
|
sa.Column('updated', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('content', sa.String(length=128), nullable=False),
|
|
|
|
sa.Column('content', sa.String(length=128), nullable=False),
|
|
|
|
sa.Column('category', sa.Enum('general', 'style', 'circle', 'artist', 'character', 'copyright', name='tag_category'), nullable=False),
|
|
|
|
sa.Column('category', sa.Enum('general', 'style', 'circle', 'artist', 'character', 'copyright', name='tag_category', native_enum=False), server_default='general', nullable=False),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('content')
|
|
|
|
sa.UniqueConstraint('content')
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -35,9 +35,13 @@ def upgrade():
|
|
|
|
sa.Column('username', sa.String(length=128), nullable=False),
|
|
|
|
sa.Column('username', sa.String(length=128), nullable=False),
|
|
|
|
sa.Column('email', sa.String(length=256), nullable=True),
|
|
|
|
sa.Column('email', sa.String(length=256), nullable=True),
|
|
|
|
sa.Column('pass_hash', sa.String(length=128), nullable=True),
|
|
|
|
sa.Column('pass_hash', sa.String(length=128), nullable=True),
|
|
|
|
sa.Column('op_level', sa.Enum('user', 'creator', 'moderator', 'admin', name='op_level'), nullable=False),
|
|
|
|
sa.Column('op_level', sa.Enum('user', 'creator', 'moderator', 'admin', name='op_level', native_enum=False), server_default='user', nullable=False),
|
|
|
|
sa.Column('user_status', sa.Enum('active', 'inactive', 'banned', name='user_status'), nullable=False),
|
|
|
|
sa.Column('user_status', sa.Enum('active', 'inactive', 'banned', name='user_status', native_enum=False), server_default='active', nullable=False),
|
|
|
|
sa.Column('last_login', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), nullable=True),
|
|
|
|
sa.Column('last_login', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), nullable=True),
|
|
|
|
|
|
|
|
sa.Column('ban_until', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), nullable=True),
|
|
|
|
|
|
|
|
sa.Column('ban_reason', sa.String(length=512), nullable=True),
|
|
|
|
|
|
|
|
sa.Column('biography', sa.String(length=512), nullable=True),
|
|
|
|
|
|
|
|
sa.Column('rating', sa.Enum('safe', 'questionable', 'explicit', name='rating', native_enum=False), server_default='safe', nullable=False),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('email'),
|
|
|
|
sa.UniqueConstraint('email'),
|
|
|
|
sa.UniqueConstraint('username')
|
|
|
|
sa.UniqueConstraint('username')
|
|
|
@ -47,9 +51,9 @@ def upgrade():
|
|
|
|
sa.Column('updated', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
|
sa.Column('updated', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
|
|
sa.Column('md5', sa.String(length=32), nullable=False),
|
|
|
|
sa.Column('md5', sa.String(length=32), nullable=False),
|
|
|
|
sa.Column('filetype', sa.Enum('png', 'jpeg', name='filetype'), nullable=False),
|
|
|
|
sa.Column('filetype', sa.Enum('png', 'jpeg', name='filetype', native_enum=False), nullable=False),
|
|
|
|
sa.Column('rating', sa.Enum('safe', 'questionable', 'explicit', name='rating'), nullable=False),
|
|
|
|
sa.Column('rating', sa.Enum('safe', 'questionable', 'explicit', name='rating', native_enum=False), nullable=False),
|
|
|
|
sa.Column('status', sa.Enum('pending', 'active', 'deleted', name='post_status'), nullable=False),
|
|
|
|
sa.Column('status', sa.Enum('pending', 'active', 'deleted', name='post_status', native_enum=False), server_default='pending', nullable=False),
|
|
|
|
sa.Column('width', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('width', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('height', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('height', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('filesize', sa.Integer(), nullable=True),
|
|
|
|
sa.Column('filesize', sa.Integer(), nullable=True),
|
|
|
@ -62,6 +66,12 @@ def upgrade():
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.PrimaryKeyConstraint('id'),
|
|
|
|
sa.UniqueConstraint('md5')
|
|
|
|
sa.UniqueConstraint('md5')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
op.create_table('user_tags_blacklist',
|
|
|
|
|
|
|
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
|
|
|
|
|
|
|
sa.Column('tag_id', sa.Integer(), nullable=True),
|
|
|
|
|
|
|
|
sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], ),
|
|
|
|
|
|
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
|
|
|
|
|
|
|
|
)
|
|
|
|
op.create_table('comment',
|
|
|
|
op.create_table('comment',
|
|
|
|
sa.Column('created', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
|
sa.Column('created', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
|
sa.Column('updated', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
|
sa.Column('updated', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
|
|
@ -88,6 +98,7 @@ def downgrade():
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
|
op.drop_table('post_tags')
|
|
|
|
op.drop_table('post_tags')
|
|
|
|
op.drop_table('comment')
|
|
|
|
op.drop_table('comment')
|
|
|
|
|
|
|
|
op.drop_table('user_tags_blacklist')
|
|
|
|
op.drop_table('post')
|
|
|
|
op.drop_table('post')
|
|
|
|
op.drop_table('user')
|
|
|
|
op.drop_table('user')
|
|
|
|
op.drop_table('tag')
|
|
|
|
op.drop_table('tag')
|