2016年3月31日 星期四

RTP over Websocket


http://stackoverflow.com/questions/18844534/rtp-over-websocket

WebRtc sample application

2016年3月30日 星期三

JHipster Liquibase 指令範例 - Maven


JHipster 已經在POM.XML 做好 Liquibase的基本設定, 因此在JHipster Code Generate 出的專案中, 可以直接利用 Maven指令, 在Project 目錄下利用 mvn 的 command line 指令, 即可Reverse database schema 以及Diff出schema與 data 的修改.

1. 設定說明



<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<configuration>
<changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>${driver.class}</driver>
<!-- Diff  Profile 指定的資料庫參數, 利用 Properties tag 另外定義 -->
<url>${jdbc.url}</url>
<defaultSchemaName></defaultSchemaName>
<username>${username}</username>
<password>${password}</password>
<!-- Diff 被比較的資料庫參數, 利用 Properties tag 另外定義 -->
<referenceUrl>${jdbc.url.dev}</referenceUrl>
<referenceDriver>${driver.class.msqldev}</referenceDriver>
<referenceUsername>${username.msqldev}</referenceUsername>
<referencePassword>${password.msqldev}</referencePassword>
<!-- 若需比對並產出資料則可加入data 選項 -->
<diffTypes>tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints</diffTypes>
<referenceDefaultSchemaName></referenceDefaultSchemaName>
<verbose>true</verbose>
<logging>${logback.loglevel}</logging>
</configuration>
...........
</plugin>
view raw gistfile1.txt hosted with ❤ by GitHub
2. 利用 Reverse 產出全部資料的 XML

         mvn -P dev liquibase:generateChangeLog

         -P :  指定Spring boot 在 Maven 定義的Profile
          generateChangeLog: reverse 全部資料


         mvn -P dev liquibase:generateChangeLog  -Dliquibase.outputChangeLogFile=./test.xml

         -Dliquibase.outputChangeLogFile: 自指定產出的XML檔案, 未指定則輸出到console


3. 利用 Diff 產出資料修改的 XML

    mvn liquibase:diff

       Spring boot預設的Profile與在pom.xml 設定在 <referenceUrl> 的料庫比對

    mvn -P prod liquibase:diff
        
     -P :  指定Spring boot 在 Maven 定義的Profile, 與在pom.xml 設定在 <referenceUrl> 的料庫比對
   

4. 利用updateSQL產出SQL指令( 不直接對資料庫下指令)

       mvn liquibase:updateSQL

5. 利用dropAll指令清除所有table

       mvn -P prod liquibase:dropAll

5. 利用clearCheckSums指令清除所有CheckSums以避免checkSum Error

        mvn -P prod liquibase:clearCheckSums

5. 利用Batch 指令執行Liquibase的Sample

// 從資料庫Reverse為Liquibase XML檔, 將changeLogFile附檔名改為.json即可改JSON格式

liquibase --driver=com.mysql.jdbc.Driver --classpath=.\mysql-connector-java-5.1.38.jar   --changeLogFile=db.changelog.xml  --url="jdbc:mysql://localhost:3306/dev?useUnicode=true&characterEncoding=UTF-8" --username=pollex --password=pollex123 generateChangeLog

// 連同 Data 一起 Reverse

liquibase --driver=com.mysql.jdbc.Driver --classpath=.\mysql-connector-java-5.1.38.jar   --changeLogFile=db.changelog.xml  --url="jdbc:mysql://localhost:3306/dev?useUnicode=true&characterEncoding=UTF-8"  --diffTypes=data --username=pollex --password=pollex generateChangeLog

//產出對資料庫建資料的SQL SCRIPT

liquibase --driver=com.mysql.jdbc.Driver --classpath=.\mysql-connector-java-5.1.38.jar   --changeLogFile=db.changelog.json  --url="jdbc:mysql://localhost:3306/dev?useUnicode=true&characterEncoding=UTF-8"  --username=pollex --password=pollex updateSQL > dbscript.sql

--diffTypes=data,tables,columns,views,primaryKeys,uniqueConstraints,indexes,foreignKeys,sequences