Liquibase研究

官网:http://www.liquibase.org/

下载地址:http://download.liquibase.org/download/?frm=n

liquibase-3.4.2-bin.tar.gz

mkdir /usr/local/liquibase-3.5.3
tar -zxf liquibase-3.5.3-bin.tar.gz -C /usr/local/liquibase-3.5.3
cd /usr/local/liquibase-3.5.3
ln -s liquibase-3.5.3/ liquibase

案例:使用sqllite3数据库

参考地址:

  • http://www.liquibase.org/quickstart.html
  • http://www.liquibase.org/sqlite.html
  • http://www.runoob.com/sqlite/sqlite-tutorial.html

下载sqlitejdbc

https://bitbucket.org/xerial/sqlite-jdbc/downloads/

java -jar /usr/local/liquibase/liquibase.jar 
--classpath=/root/test/sqlite-jdbc-3.19.3.jar 
--driver=org.sqlite.JDBC 
--url="jdbc:sqlite:exampledb.sqlite" 
--changeLogFile=/root/test/db.changelog.xml 
migrate

执行完成会在当前目录下生成exampledb.sqlite数据库文件,验证数据库修改结果

# sqlite3 exampledb.sqlite 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .database
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /usr/local/exampledb.sqlite                               
sqlite> .tables
DATABASECHANGELOG      DATABASECHANGELOGLOCK  department           
sqlite> .schema department
CREATE TABLE department (id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, active BOOLEAN DEFAULT 1, CONSTRAINT PK_DEPARTMENT PRIMARY KEY (id));

 

posted @ 2017-07-25 17:50  每天进步一点点!!!  阅读(716)  评论(0)    收藏  举报