aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-07-07 03:24:50 +0800
committertechknowlogick <techknowlogick@gitea.io>2019-07-06 15:24:50 -0400
commit337d6915ff8967637ff515108612c3a7a4f51585 (patch)
tree702e0f4d310fa03a635c27ab0e7c1702aac3196d /models
parentef57fe4ae3c517a0bb10b81a641fb76976f404d3 (diff)
downloadgitea-337d6915ff8967637ff515108612c3a7a4f51585.tar.gz
gitea-337d6915ff8967637ff515108612c3a7a4f51585.zip
Detect migrating batch size (#7353)
* Make migrating batch size as configurable * detect different table batch insert size and remove config item * remove unrelated changes
Diffstat (limited to 'models')
-rw-r--r--models/models.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go
index 3b3d8ec30a..f746f680a5 100644
--- a/models/models.go
+++ b/models/models.go
@@ -368,3 +368,9 @@ func DumpDatabase(filePath string, dbType string) error {
}
return x.DumpTablesToFile(tbs, filePath)
}
+
+// MaxBatchInsertSize returns the table's max batch insert size
+func MaxBatchInsertSize(bean interface{}) int {
+ t := x.TableInfo(bean)
+ return 999 / len(t.ColumnsSeq())
+}