-1

the way we apply schema update is like this:

  • wrap every SQL into a string
  • create a update object, which takes the SQL, a version id, and another string "update reason "
  • suppose we have 100 updates, each one will be created, and save into a list
  • then loop through the list compare the version id with the current version id saved in the database, the update will be applied only if it above the current version.

the problem is we have more then 4000 lines of code in this class.

most of the updates have been done a few years ago, I hate to load them every time

is there a better way to do it in java?

4

2 に答える 2

2

これを行うツールはたくさんあります。たくさん見て、私はLiquibaseに行くことになりました。変更はファイルに保存され、バージョン管理することもできます。githubまたはbitbucketのいずれかを使用している場合は、ユーザーはファイルにアクセスしたときにそれらを確認したり、コメントしたりできます。

于 2013-01-16T17:42:18.233 に答える
0

You could put the sql into files instead in the java code. The file naming strategy of the sql files could have the version and update reason as part of the file name or you could put the reason in the file. The code would loop thru the files in the directory and add them to a list and then process as you normally would.

于 2013-01-16T17:37:05.087 に答える