weixin_39890652 2020-11-30 11:22
浏览 0

Column renames not supported on SQLite

Migrated issue, originally created by Wichert Akkerman ()

SQLite does not support renaming a column directly, so you need a magic dance: create a new column, copy the right data to it and then remove the old column, taking care to only add constraints after copying the data.

该提问来源于开源项目:sqlalchemy/alembic

  • 写回答

31条回答 默认 最新

  • weixin_39890652 2020-11-30 11:22
    关注

    Michael Bayer () wrote:

    Yeah this is a feature I specially don't want to add to Alembic (Edit: please see below where I have softened my stance here). I'd rather SQLite get on board with basic alteration capability.

    I've mentioned this in the README and CHANGES. Feel free to try changing my mind again but I don't think SQLite is appropriate for a long-term data store. An app with a new schema should just read the SQLite DB in, write it out to a new one, or just use Postgresql.

    评论

报告相同问题?