674bb6602f02_drop_topic.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:hreftoday 作者: soasme 项目源码 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('topic',
    sa.Column('id', sa.INTEGER(), server_default=sa.text(u"nextval('topic_id_seq'::regclass)"), nullable=False),
    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('title', sa.VARCHAR(length=128), autoincrement=False, nullable=False),
    sa.Column('description', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('is_deleted', sa.BOOLEAN(), server_default=sa.text(u'false'), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_topic_user'),
    sa.PrimaryKeyConstraint('id', name=u'topic_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('topic_follow',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['topic_id'], [u'topic.id'], name=u'fk_topic_follow_topic'),
    sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_topic_follow_user'),
    sa.PrimaryKeyConstraint('id', name=u'topic_follow_pkey'),
    sa.UniqueConstraint('topic_id', 'user_id', name=u'ux_topic_follow_user_follow_topic')
    )
    op.add_column('link', sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.create_foreign_key(u'fk_link_topic', 'link', 'topic', ['topic_id'], ['id'])
    ### end Alembic commands ###
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号