Migrated issue, originally created by Pekka Järvinen ()
Hi,
alembic is only generating the first CheckConstraint in the migrations file.
In __table_args__:
class User(Base):
__tablename__ = 'users'
__table_args__ = (
CheckConstraint("login ~* '^[a-z]{3,}$'", name = __tablename__ + "_chk_login"),
CheckConstraint("login != ''", name = __tablename__ + "_chk_login_not_empty"),
CheckConstraint("password != ''", name = __tablename__ + "_chk_pw_not_empty"),
)
id = Column(Sequence(__tablename__ + "_id_seq"), primary_key = True, nullable = False)
login = Column(Unicode(64), unique = True, nullable = False, default = "", index = True)
password = Column(Unicode(255), nullable = False, default = "")
Outside of __table_args__
class User(Base):
__tablename__ = 'users'
id = Column(Sequence(__tablename__ + "_id_seq"), primary_key = True, nullable = False)
login = Column(Unicode(64), unique = True, nullable = False, default = "", index = True)
password = Column(Unicode(255), nullable = False, default = "")
checks = Column(
CheckConstraint("login ~* '^[a-z]{3,}$'", name = __tablename__ + "_chk_login"),
CheckConstraint("login != ''", name = __tablename__ + "_chk_login_not_empty"),
CheckConstraint("password != ''", name = __tablename__ + "_chk_pw_not_empty"),
)
How to add multiple CheckConstraints? I couldn't find any documentation regarding this issue.
I'm using latest PostgreSQL, SQLAlchemy, Pyramid and alembic.
该提问来源于开源项目:sqlalchemy/alembic