"""initial scheme Revision ID: 71386dc42f9b Revises: Create Date: 2020-03-16 00:26:18.607144 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utc # revision identifiers, used by Alembic. revision = '71386dc42f9b' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('tag', 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('id', sa.Integer(), 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', native_enum=False), server_default='general', nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('content') ) op.create_table('user', 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('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=128), nullable=False), sa.Column('email', sa.String(length=256), 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', native_enum=False), server_default='user', 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('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.UniqueConstraint('email'), sa.UniqueConstraint('username') ) op.create_table('post', 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('id', sa.Integer(), nullable=False), sa.Column('md5', sa.String(length=32), 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', native_enum=False), 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('height', sa.Integer(), nullable=True), sa.Column('filesize', sa.Integer(), nullable=True), sa.Column('source', sa.String(length=2048), nullable=True), sa.Column('origin_filename', sa.String(length=255), nullable=True), sa.Column('author_id', sa.Integer(), nullable=True), sa.Column('approver_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['approver_id'], ['user.id'], ), sa.ForeignKeyConstraint(['author_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id'), 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', 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('id', sa.Integer(), nullable=False), sa.Column('content', sa.String(length=512), nullable=False), sa.Column('deleted', sa.Boolean(), nullable=True), sa.Column('delete_reason', sa.String(length=512), nullable=True), sa.Column('post_id', sa.Integer(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['post_id'], ['post.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('post_tags', sa.Column('post_id', sa.Integer(), nullable=True), sa.Column('tag_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['post_id'], ['post.id'], ), sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], ) ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('post_tags') op.drop_table('comment') op.drop_table('user_tags_blacklist') op.drop_table('post') op.drop_table('user') op.drop_table('tag') # ### end Alembic commands ###