search

Home  >  Q&A  >  body text

python - 在flask-sqlalchemy中执行db upgrade数据库迁移时,报错一个表已经存在?

sqlalchemy.exc.OperationalError: (OperationalError) (1050, "Table 'pcoip_model' already exists") 'nCREATE TABLE pcoip_model (ntid INTEGER NOT NULL AUTO_INCREMENT, ntitems VARCHAR(64), ntitems_values VARCHAR(64), ntPRIMARY KEY (id)n)nn' ()

PHPzPHPz2895 days ago524

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-18 09:53:23

    Just delete the table from the database
    or try again

    db init 
    db migrate
    db upgrade

    reply
    0
  • 迷茫

    迷茫2017-04-18 09:53:23

    Don’t use flask-migrate. Nine times out of ten, something will go wrong. Manually modifying the database and migrating data is the most reliable method.

    reply
    0
  • Cancelreply