sqlite3 脚本制作

前端之家收集整理的这篇文章主要介绍了sqlite3 脚本制作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_0@最近开发的程序,因为bd设计和需求更新问题。

@H_502_0@需要对数据库进行修改

@H_502_0@因此有了脚本化 升级数据库的需求;

@H_502_0@---

@H_502_0@建立 .sh 文件 例如: updatedb.sh

@H_502_0@里面写入命令:

@H_502_0@sqlite3 xxx.db<<EOF

@H_502_0@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;

@H_502_0@EOF

@H_502_0@完成;

@H_502_0@EOF 很重要 EOF 很重要 EOF 很重要

猜你在找的Sqlite相关文章