nonebot-bison/nonebot_bison/config/migrations/0571870f5222_init_db.py
uy/sun 90816796c7
🚚 修改 nonebot_bison 项目结构 (#211)
* 🎨 修改 nonebot_bison 目录位置

* auto fix by pre-commit hooks

* 🚚 fix frontend build target

* 🚚 use soft link

* Revert "🚚 use soft link"

This reverts commit de21f79d5ae1bd5515b04f42a4138cb25ddf3e62.

* 🚚 modify dockerfile

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: felinae98 <731499577@qq.com>
2023-03-09 17:32:51 +08:00

61 lines
1.8 KiB
Python

"""init db
Revision ID: 0571870f5222
Revises:
Create Date: 2022-03-21 19:18:13.762626
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "0571870f5222"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"target",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("platform_name", sa.String(length=20), nullable=False),
sa.Column("target", sa.String(length=1024), nullable=False),
sa.Column("target_name", sa.String(length=1024), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"user",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("type", sa.String(length=20), nullable=False),
sa.Column("uid", sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"subscribe",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("target_id", sa.Integer(), nullable=True),
sa.Column("user_id", sa.Integer(), nullable=True),
sa.Column("categories", sa.String(length=1024), nullable=True),
sa.Column("tags", sa.String(length=1024), nullable=True),
sa.ForeignKeyConstraint(
["target_id"],
["target.id"],
),
sa.ForeignKeyConstraint(
["user_id"],
["user.id"],
),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("subscribe")
op.drop_table("user")
op.drop_table("target")
# ### end Alembic commands ###