0

I'm using SQL alechmy for a project, I've got a system running with some important data, but I would like to update my schemas to make new features. What's the best practice here? Can schemas be updated without dropping all tables and recreate database? (currently I am running into trouble with

manage.py migrate

Not working. Ie. Not picking up new changes to table fields)

Thanks a lot in advance, C

C Lu
  • 87
  • 8
  • 1
    flask-migrate is an option, but only updates columns from what I recall of the docs. tbh I used to be very unclear on almost everything to do with the actual database, which made the work very shoddy, until I bothered to learn specifically about the database and SQL commands. You'll do yourself a massive favour if you just spend a day or two on pure database tutorials learning how to create tables/records, update records, and alter table schema including indexes and foreign keys from either SQL string or a GUI like pgadmin4 (for postgres) or HeidiSQL/MysqlWorkbench/phpmyadmin (mariadb, mysql). – G.S Jan 06 '22 at 23:54
  • 1
    The best way to run migration in SQLAlchemy ORM is `alembic`: https://alembic.sqlalchemy.org/en/latest/tutorial.html. `flask-migrate` is a wrapper to it. – jorzel Jan 07 '22 at 20:58

0 Answers0