SQLite Modify Column

后端 未结 4 1395
迷失自我
迷失自我 2020-12-02 22:26

I need to modify a column in a SQLite database but I have to do it programatically due to the database already being in production. From my research I have found that in or

4条回答
  •  星月不相逢
    2020-12-02 23:04

    If the modification is not too big (e.g. change the length of a varchar), you can dump the db, manually edit the database definition and import it back again:

    echo '.dump' | sqlite3 test.db > test.dump
    

    then open the file with a text editor, search for the definition you want to modify and then:

    cat test.dump | sqlite3 new-test.db
    

提交回复
热议问题