Mic*_*icz 5 python migration postgresql sqlalchemy alembic
我是 alembic 和 sqlalchemy 世界的新手
可以说我有模型:
class Model(Base):
__tablename__ = 'models'
id = Column(Integer, primary_key=True)
value = Column(Integer, CheckContraint('value >= 0'))
Run Code Online (Sandbox Code Playgroud)
如果我做 alembic --config=development.ini revision --autogenerate -m "init" 我得到例如
def upgrade():
op.create_table('models',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('value', sa.Integer())
Run Code Online (Sandbox Code Playgroud)
在这里我错过了 create_check_constraint 我怎样才能自动执行它还是应该手动添加它?我希望它能与 postgresql 一起使用
Alembic 自动生成当前不支持检查约束检测。
\n\n\n\n目前自动生成可以\xe2\x80\x99t,但最终会检测到:
\n一些独立的约束添加和删除,例如 CHECK、PRIMARY KEY - 这些尚未完全实现。
\n
似乎您需要手动执行此操作,例如使用execute。
\n| 归档时间: |
|
| 查看次数: |
1285 次 |
| 最近记录: |