More Related Content
Similar to 使用 Liquibase 發展資料庫結構 (20)
使用 Liquibase 發展資料庫結構
- 2. Ref: Datical DB
• 高控制性
• 無法自動判斷變更的版本
• 需要依賴人工介入
• 很難處理不同版本的資料庫轉移
• 與程式碼的耦合度高
• 可以透過不同的 dialect 處理不同的資料庫
• 只能有條件的管理變更
• 很難處理資料的變更
SQL JPA
- 5. 支援
• Java 1.4 和 1.5
• MySQL, PostgreSQL, Oracle, Sql Server, Sybase,
DB2, Derby, HSQL, H2, Informix, Firebird, SQLite
• Command Line, Ant, Maven, Gradle, Spring-boot…
• XML, YAML, JSON, SQL
- 8. <databaseChangeLog xmlns=“…”>
<changeSet id="00000000000001" author=“steven">
<createTable tableName="user">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="name" type="varchar(100)"/>
</createTable>
<rollback>
drop table user
</rollback>
</changeSet>
</databaseChangeLog>
- 11. Best Practices
• 透過 master.xml 來管理所有的 ChangeSet
• 不更改已執行過的 ChangeSet
• 確保所有的 ChangeSet 都有 Rollback
Ref: Liquibase Best Practices
- 13. 練習資源
• Tutorial using Oracle
• http://www.liquibase.org/tutorial-using-oracle
• JCConf TW 2015 Database Continuous Integration
• https://github.com/wang-steven/jcconf-tw-2015