Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
8f81f962
Commit
8f81f962
authored
Sep 22, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔖
兼容 H2 升级 v2.4.0
parent
45026d89
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
src/main/java/org/b3log/solo/service/UpgradeService.java
src/main/java/org/b3log/solo/service/UpgradeService.java
+18
-6
No files found.
src/main/java/org/b3log/solo/service/UpgradeService.java
View file @
8f81f962
...
@@ -52,7 +52,7 @@ import java.sql.Statement;
...
@@ -52,7 +52,7 @@ import java.sql.Statement;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="mailto:dongxu.wang@acm.org">Dongxu Wang</a>
* @author <a href="mailto:dongxu.wang@acm.org">Dongxu Wang</a>
* @version 1.2.0.1
8, Sep 1
2, 2017
* @version 1.2.0.1
9, Sep 2
2, 2017
* @since 1.2.0
* @since 1.2.0
*/
*/
@Service
@Service
...
@@ -175,6 +175,8 @@ public class UpgradeService {
...
@@ -175,6 +175,8 @@ public class UpgradeService {
LOGGER
.
log
(
Level
.
INFO
,
"Upgrading from version [{0}] to version [{1}]...."
,
FROM_VER
,
TO_VER
);
LOGGER
.
log
(
Level
.
INFO
,
"Upgrading from version [{0}] to version [{1}]...."
,
FROM_VER
,
TO_VER
);
final
Transaction
transaction
=
optionRepository
.
beginTransaction
();
final
Transaction
transaction
=
optionRepository
.
beginTransaction
();
final
boolean
isH2database
=
Latkes
.
getRuntimeDatabase
()
==
Latkes
.
RuntimeDatabase
.
H2
;
try
{
try
{
final
String
tablePrefix
=
Latkes
.
getLocalProperty
(
"jdbc.tablePrefix"
)
+
"_"
;
final
String
tablePrefix
=
Latkes
.
getLocalProperty
(
"jdbc.tablePrefix"
)
+
"_"
;
...
@@ -186,31 +188,41 @@ public class UpgradeService {
...
@@ -186,31 +188,41 @@ public class UpgradeService {
final
JSONObject
statisticBlogArticleCountOpt
=
new
JSONObject
();
final
JSONObject
statisticBlogArticleCountOpt
=
new
JSONObject
();
statisticBlogArticleCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
);
statisticBlogArticleCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
);
statisticBlogArticleCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
));
statisticBlogArticleCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_BLOG_ARTICLE_COUNT
));
statisticBlogArticleCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
statisticBlogArticleCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticBlogArticleCountOpt
);
optionRepository
.
add
(
statisticBlogArticleCountOpt
);
final
JSONObject
statisticBlogCommentCountOpt
=
new
JSONObject
();
final
JSONObject
statisticBlogCommentCountOpt
=
new
JSONObject
();
statisticBlogCommentCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
);
statisticBlogCommentCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
);
statisticBlogCommentCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
));
statisticBlogCommentCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_BLOG_COMMENT_COUNT
));
statisticBlogCommentCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
statisticBlogCommentCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticBlogCommentCountOpt
);
optionRepository
.
add
(
statisticBlogCommentCountOpt
);
final
JSONObject
statisticBlogViewCountOpt
=
new
JSONObject
();
final
JSONObject
statisticBlogViewCountOpt
=
new
JSONObject
();
statisticBlogViewCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
);
statisticBlogViewCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
);
statisticBlogViewCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
));
statisticBlogViewCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_BLOG_VIEW_COUNT
));
statisticBlogViewCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
statisticBlogViewCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticBlogViewCountOpt
);
optionRepository
.
add
(
statisticBlogViewCountOpt
);
final
JSONObject
statisticPublishedBlogArticleCountOpt
=
new
JSONObject
();
final
JSONObject
statisticPublishedBlogArticleCountOpt
=
new
JSONObject
();
statisticPublishedBlogArticleCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
);
statisticPublishedBlogArticleCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
);
statisticPublishedBlogArticleCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
));
statisticPublishedBlogArticleCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_PUBLISHED_ARTICLE_COUNT
));
statisticPublishedBlogArticleCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
statisticPublishedBlogArticleCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticPublishedBlogArticleCountOpt
);
optionRepository
.
add
(
statisticPublishedBlogArticleCountOpt
);
final
JSONObject
statisticPublishedBlogCommentCountOpt
=
new
JSONObject
();
final
JSONObject
statisticPublishedBlogCommentCountOpt
=
new
JSONObject
();
statisticPublishedBlogCommentCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
);
statisticPublishedBlogCommentCountOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
);
statisticPublishedBlogCommentCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
));
statisticPublishedBlogCommentCountOpt
.
put
(
Option
.
OPTION_VALUE
,
statistic
.
optString
(
isH2database
?
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
.
toUpperCase
()
:
Option
.
ID_C_STATISTIC_PUBLISHED_BLOG_COMMENT_COUNT
));
statisticPublishedBlogCommentCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
statisticPublishedBlogCommentCountOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_STATISTIC
);
optionRepository
.
add
(
statisticPublishedBlogCommentCountOpt
);
optionRepository
.
add
(
statisticPublishedBlogCommentCountOpt
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment