You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2024/03/07 04:23:33 UTC
(incubator-answer) branch feat/1.3.0/review updated: feat(migration): add migrations
This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch feat/1.3.0/review
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/feat/1.3.0/review by this push:
new 51067793 feat(migration): add migrations
51067793 is described below
commit 51067793e3893d4b86bb703367fc8f0c0d2e16e3
Author: LinkinStars <li...@foxmail.com>
AuthorDate: Thu Mar 7 11:15:54 2024 +0800
feat(migration): add migrations
---
internal/migrations/migrations.go | 1 +
internal/migrations/v20.go | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/internal/migrations/migrations.go b/internal/migrations/migrations.go
index dbd3acdb..8a259684 100644
--- a/internal/migrations/migrations.go
+++ b/internal/migrations/migrations.go
@@ -95,6 +95,7 @@ var migrations = []Migration{
NewMigration("v1.2.0", "add recover answer permission", addRecoverPermission, true),
NewMigration("v1.2.1", "add password login control", addPasswordLoginControl, true),
NewMigration("v1.2.5", "add notification plugin and theme config", addNotificationPluginAndThemeConfig, true),
+ NewMigration("v1.3.0", "add review", addReview, false),
}
func GetMigrations() []Migration {
diff --git a/internal/migrations/v20.go b/internal/migrations/v20.go
new file mode 100644
index 00000000..84c9c045
--- /dev/null
+++ b/internal/migrations/v20.go
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package migrations
+
+import (
+ "context"
+
+ "github.com/apache/incubator-answer/internal/entity"
+ "xorm.io/xorm"
+)
+
+func addReview(ctx context.Context, x *xorm.Engine) error {
+ return x.Context(ctx).Sync(new(entity.Review))
+}