diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2021-03-29 00:42:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-29 00:42:48 -0700 |
| commit | 1ebdbad222207c858e9f1285bc7d854f7a943754 (patch) | |
| tree | 5e9f8b8ac16d2e3cb795f85b49d0352e20cffeb3 /weed/command/scaffold.go | |
| parent | 6b7aa9633fcffe36b29961108d1d811952ab093a (diff) | |
| parent | 96c62bd34d4d2c99dea3164a9c062abaddb4eaab (diff) | |
| download | seaweedfs-1ebdbad222207c858e9f1285bc7d854f7a943754.tar.xz seaweedfs-1ebdbad222207c858e9f1285bc7d854f7a943754.zip | |
Merge pull request #1946 from LazyDBA247-Anyvision/master
Adding Customisation - insertQuery for postgres/mysql
Diffstat (limited to 'weed/command/scaffold.go')
| -rw-r--r-- | weed/command/scaffold.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go index 52b547563..3296ebf21 100644 --- a/weed/command/scaffold.go +++ b/weed/command/scaffold.go @@ -102,6 +102,10 @@ enabled = false dir = "./filerrdb" # directory to store rocksdb files [mysql] # or memsql, tidb +# 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 = "" # CREATE TABLE IF NOT EXISTS filemeta ( # dirhash BIGINT COMMENT 'first 64 bits of MD5 hash value of directory field', # name VARCHAR(1000) BINARY COMMENT 'directory or file name', @@ -123,6 +127,10 @@ interpolateParams = false [mysql2] # or memsql, tidb enabled = 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 = "" createTable = """ CREATE TABLE IF NOT EXISTS ` + "`%s`" + ` ( dirhash BIGINT, @@ -143,6 +151,10 @@ connection_max_lifetime_seconds = 0 interpolateParams = false [postgres] # or cockroachdb, YugabyteDB +# 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 = "" # CREATE TABLE IF NOT EXISTS filemeta ( # dirhash BIGINT, # name VARCHAR(65535), @@ -164,6 +176,10 @@ connection_max_lifetime_seconds = 0 [postgres2] enabled = false +# 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 = "" createTable = """ CREATE TABLE IF NOT EXISTS "%s" ( dirhash BIGINT, |
