sqlite3 脚本制做

最近开发的程序,由于bd设计和需求更新问题。sql

须要对数据库进行修改。数据库

所以有了脚本化 升级数据库的需求;设计

---sqlite

创建 .sh 文件 例如: updatedb.sh开发

里面写入命令:it

sqlite3 xxx.db<<EOFtable

drop table if exists temp;
ALTER TABLE table_xx_name RENAME TO temp;
create table if not exists table_xx_name (xxxxxxxx);
insert into table_xx_name (_id,各个字段以逗号分割) select _id,选中字段以逗号分割 可是没有 括号 from temp;
drop table temp;date

EOFselect

完成;程序

EOF 很重要 EOF 很重要  EOF 很重要

相关文章
相关标签/搜索