I need to upgrade a model (add some columns) in my Flask app and I try to use Flask-Migrate
to do this.
Problem : No support for ALTER of constraints in SQLite.
Commands I used : db migrate
> db upgrade
I read that there's probably something in the env.py
file of migrations folder that needs to be changed but I'm a bit lost with that.
I don't want to drop/create all stuff..
I use Flask-SQLAlchemy to manage my database stuff.
Here is the code auto generated by Alembic for the migration :
from alembic import op
import sqlalchemy as sa
... # revisions identifiers
def upgrade():
op.create_foreign_key(None, 'notes', 'user', ['owner_id'], ['id'])
op.add_column('user', sa.Column('name', sa.String(length=50), ))
op.add_column('user', sa.Column('website', sa.String(length=120), nullable=True))
def downgrade():
op.drop_column('user', 'website')
op.drop_column('user', 'name')
op.drop_constraint(None, 'notes', type_='foreignkey')
Could you help me ?