2012-07-31 43 views
0

我想要的代碼,做這樣的任務:用於創建數據庫,表,列和填充表的「解決方案」?

check if a given database exists. 
1a-->if no, then create a DB, make some tables in it and some columns too. 

    1.1-->Check if certain columns in a "list" exist. 
     Create those columns which don't exist yet. 
    1.2--> once 1.1 is done, populate these tables with some test data. 

1b-->else check if certain tables exist and create them if they 
    don't exist. After that, do the stuff mentioned in 1.1 and 1.2 

讓我的自己的代碼還是有一個「解決方案」,它已經存在這樣的任務?

回答

2

我可以推薦別的東西flyway,希望你會覺得很容易把握

+0

謝謝!我會仔細看看的。它看起來很輕。 – 2012-07-31 23:46:37

2

我不知道你在問什麼,但我相信你可以通過LiquiBase實現你所需要的。

+0

謝謝!看起來像我需要的東西。但對我來說這將是一個巨大的學習曲線。是否有一些小型API或代碼可以完成這項任務?我可以自己編寫代碼,但這會很痛苦。 – 2012-07-31 23:08:19