aboutsummaryrefslogtreecommitdiff
path: root/weed/command
diff options
context:
space:
mode:
authorLazyDBA247-Anyvision <yonin@anyvision.co>2021-03-30 00:32:03 +0300
committerLazyDBA247-Anyvision <yonin@anyvision.co>2021-03-30 00:32:03 +0300
commit4c51e6a6605ce4592957c047c73c345a0a12bae3 (patch)
tree5df4179dd2bb1503409fea75abfc36e702810c0a /weed/command
parent3cf84b5fae0634a018f00dec5e4b04a839fe4b0c (diff)
downloadseaweedfs-4c51e6a6605ce4592957c047c73c345a0a12bae3.tar.xz
seaweedfs-4c51e6a6605ce4592957c047c73c345a0a12bae3.zip
add enableUpsert=true
and rename config to upsertQuery
Diffstat (limited to 'weed/command')
-rw-r--r--weed/command/scaffold.go28
1 files changed, 12 insertions, 16 deletions
diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go
index 337adaa22..babcdcdc7 100644
--- a/weed/command/scaffold.go
+++ b/weed/command/scaffold.go
@@ -120,10 +120,9 @@ connection_max_idle = 2
connection_max_open = 100
connection_max_lifetime_seconds = 0
interpolateParams = false
-# Empty insertQuery will use the default insert query
-# example insertQuery can be for UPSERT syntax:
-# insertQuery = """INSERT INTO ` + "`%s`" + ` (dirhash,name,directory,meta) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE meta = VALUES(meta)"""
-insertQuery = ""
+# if insert/upsert failing, you can disable upsert or update query syntax to match your RDBMS syntax:
+upsertQuery = """INSERT INTO ` + "`%s`" + ` (dirhash,name,directory,meta) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE meta = VALUES(meta)"""
+enableUpsert = true
[mysql2] # or memsql, tidb
enabled = false
@@ -145,10 +144,9 @@ connection_max_idle = 2
connection_max_open = 100
connection_max_lifetime_seconds = 0
interpolateParams = false
-# Empty insertQuery will use the default insert query
-# example insertQuery can be for UPSERT syntax:
-# insertQuery = """INSERT INTO ` + "`%s`" + ` (dirhash,name,directory,meta) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE meta = VALUES(meta)"""
-insertQuery = ""
+# if insert/upsert failing, you can disable upsert or update query syntax to match your RDBMS syntax:
+upsertQuery = """INSERT INTO ` + "`%s`" + ` (dirhash,name,directory,meta) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE meta = VALUES(meta)"""
+enableUpsert = true
[postgres] # or cockroachdb, YugabyteDB
# CREATE TABLE IF NOT EXISTS filemeta (
@@ -169,10 +167,9 @@ sslmode = "disable"
connection_max_idle = 100
connection_max_open = 100
connection_max_lifetime_seconds = 0
-# Empty insertQuery will use the default insert query
-# example insertQuery can be for UPSERT syntax:
-# insertQuery = """INSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4) ON CONFLICT ON CONSTRAINT "%[1]s_pkey" DO UPDATE SET meta = EXCLUDED.meta WHERE "%[1]s".meta != EXCLUDED.meta"""
-insertQuery = ""
+# if insert/upsert failing, you can disable upsert or update query syntax to match your RDBMS syntax:
+upsertQuery = """INSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4) ON CONFLICT ON CONSTRAINT "%[1]s_pkey" DO UPDATE SET meta = EXCLUDED.meta WHERE "%[1]s".meta != EXCLUDED.meta"""
+enableUpsert = true
[postgres2]
enabled = false
@@ -195,10 +192,9 @@ sslmode = "disable"
connection_max_idle = 100
connection_max_open = 100
connection_max_lifetime_seconds = 0
-# Empty insertQuery will use the default insert query
-# example insertQuery can be for UPSERT syntax:
-# insertQuery = """INSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4) ON CONFLICT ON CONSTRAINT "%[1]s_pkey" DO UPDATE SET meta = EXCLUDED.meta WHERE "%[1]s".meta != EXCLUDED.meta"""
-insertQuery = ""
+# if insert/upsert failing, you can disable upsert or update query syntax to match your RDBMS syntax:
+upsertQuery = """INSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4) ON CONFLICT ON CONSTRAINT "%[1]s_pkey" DO UPDATE SET meta = EXCLUDED.meta WHERE "%[1]s".meta != EXCLUDED.meta"""
+enableUpsert = true
[cassandra]
# CREATE TABLE filemeta (