12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- """empty message
- Revision ID: 566a5752c06e
- Revises:
- Create Date: 2022-10-16 17:02:52.251961
- """
- from alembic import op
- import sqlalchemy as sa
- # revision identifiers, used by Alembic.
- revision = '566a5752c06e'
- down_revision = None
- branch_labels = None
- depends_on = None
- def upgrade():
- # ### commands auto generated by Alembic - please adjust! ###
- op.create_table('archive',
- sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
- sa.Column('name', sa.String(length=32), nullable=False),
- sa.Column('describe', sa.String(length=100), nullable=False),
- sa.PrimaryKeyConstraint('id'),
- sa.UniqueConstraint('name')
- )
- op.create_table('role',
- sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
- sa.Column('name', sa.String(length=32), nullable=False),
- sa.Column('permission', sa.Integer(), nullable=False),
- sa.PrimaryKeyConstraint('id'),
- sa.UniqueConstraint('name')
- )
- op.create_table('user',
- sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
- sa.Column('email', sa.String(length=32), nullable=False),
- sa.Column('passwd_hash', sa.String(length=128), nullable=False),
- sa.Column('role_id', sa.Integer(), nullable=True),
- sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
- sa.PrimaryKeyConstraint('id'),
- sa.UniqueConstraint('email')
- )
- op.create_table('comment',
- sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
- sa.Column('title', sa.String(length=32), nullable=True),
- sa.Column('content', sa.Text(), nullable=False),
- sa.Column('create_time', sa.DateTime(), nullable=False),
- sa.Column('update_time', sa.DateTime(), nullable=False),
- sa.Column('auth_id', sa.Integer(), nullable=False),
- sa.Column('father_id', sa.Integer(), nullable=True),
- sa.ForeignKeyConstraint(['auth_id'], ['user.id'], ),
- sa.ForeignKeyConstraint(['father_id'], ['comment.id'], ),
- sa.PrimaryKeyConstraint('id')
- )
- op.create_table('follow',
- sa.Column('time', sa.DateTime(), nullable=False),
- sa.Column('follower_id', sa.Integer(), nullable=True),
- sa.Column('followed_id', sa.Integer(), nullable=True),
- sa.ForeignKeyConstraint(['followed_id'], ['user.id'], ),
- sa.ForeignKeyConstraint(['follower_id'], ['user.id'], ),
- sa.PrimaryKeyConstraint('follower_id', 'followed_id')
- )
- op.create_table('archive_comment',
- sa.Column('archive_id', sa.Integer(), nullable=False),
- sa.Column('comment_id', sa.Integer(), nullable=False),
- sa.ForeignKeyConstraint(['archive_id'], ['archive.id'], ),
- sa.ForeignKeyConstraint(['comment_id'], ['comment.id'], ),
- sa.PrimaryKeyConstraint('archive_id', 'comment_id')
- )
- # ### end Alembic commands ###
- def downgrade():
- # ### commands auto generated by Alembic - please adjust! ###
- op.drop_table('archive_comment')
- op.drop_table('follow')
- op.drop_table('comment')
- op.drop_table('user')
- op.drop_table('role')
- op.drop_table('archive')
- # ### end Alembic commands ###
|