You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In migrations versions .py file, foreign key is being set as None instead of 'fk_ab_user_company_id_company'
with op.batch_alter_table('ab_user', schema=None) as batch_op:
batch_op.add_column(sa.Column('company_id', sa.Integer(), nullable=True))
batch_op.create_foreign_key(None, 'company', ['company_id'], ['id'])
should be
with op.batch_alter_table('ab_user', schema=None) as batch_op:
batch_op.add_column(sa.Column('company_id', sa.Integer(), nullable=True))
batch_op.create_foreign_key(batch_op.f('fk_ab_user_company_id_company'), 'company', ['company_id'], ['id'])
Because the naming convention is not used, this error results when trying to run flask db upgrade
File "../python3.9/site-packages/alembic/operations/batch.py", line 669, in add_constraintraiseValueError("Constraint must have a name")
ValueError: Constraint must have a name
Steps to reproduce
implement changes to models.py and init.py
run the following
flask db init
flask db migrate
flask db upgrade
The text was updated successfully, but these errors were encountered:
Environment
Flask-Appbuilder version: 4.1.4
pip freeze output:
alembic==1.13.3
Flask-AppBuilder==4.1.4
Flask-Migrate==4.0.7
Flask-SQLAlchemy==2.5.1
SQLAlchemy==1.4.51
Describe the expected results
In migrations versions .py file, foreign key should follow naming convention specified
Describe the actual results
In migrations versions .py file, foreign key is being set as None instead of 'fk_ab_user_company_id_company'
should be
Because the naming convention is not used, this error results when trying to run flask db upgrade
Steps to reproduce
flask db init
flask db migrate
flask db upgrade
The text was updated successfully, but these errors were encountered: