This is an automated email from the ASF dual-hosted git repository.
liuhongyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 74954fa2b9 [type:fix] fix database init script (#6277)
74954fa2b9 is described below
commit 74954fa2b9e5a8d0426929ad754a78048be32c9f
Author: eye-gu <[email protected]>
AuthorDate: Mon Jan 26 22:28:22 2026 +0800
[type:fix] fix database init script (#6277)
* [type:fix] fix database init script
* Fix test unnecessary stubbing
---
db/init/ob/schema.sql | 11 +----------
db/init/og/create-table.sql | 8 ++++----
db/init/oracle/schema.sql | 18 +++++++++---------
db/init/pg/create-table.sql | 8 ++++----
.../shenyu/infra/etcd/client/EtcdClientTest.java | 3 +++
5 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/db/init/ob/schema.sql b/db/init/ob/schema.sql
index f86b11bcf0..906323b20b 100644
--- a/db/init/ob/schema.sql
+++ b/db/init/ob/schema.sql
@@ -1400,7 +1400,6 @@ INSERT INTO `plugin_handle` VALUES
('1722804548510507035', '50', 'apiKey', 'apiK
INSERT INTO `plugin_handle` VALUES ('1722804548510507037', '50',
'temperature', 'temperature', 2, 3, 5, '{\"required\":\"0\",\"rule\":\"\",
\"placeholder\":\"optional,0,0.01~1\"}', '2024-01-02 17:20:50.233', '2024-01-02
17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507038', '50', 'maxTokens',
'maxTokens', 2, 3, 6, '{\"required\":\"0\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507039', '50', 'stream',
'stream', 3, 3, 7, '{\"defaultValue\":\"false\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371600', '50',
'proxyEnabled', 'proxyEnabled', 2, 3, 8,
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507040', '50', 'prompt',
'prompt', 2, 3, 9, '{\"required\":\"0\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507041', '50', 'provider',
'provider', 3, 1, 0,
'{\"required\":\"0\",\"defaultValue\":\"OpenAI\",\"placeholder\":\"provider\",\"rule\":\"\"}',
'2024-01-02 17:20:50.233', '2024-01-02 17:20:50.233');
@@ -1410,8 +1409,8 @@ INSERT INTO `plugin_handle` VALUES
('1722804548510507044', '50', 'apiKey', 'apiK
INSERT INTO `plugin_handle` VALUES ('1722804548510507045', '50',
'temperature', 'temperature', 2, 1, 4, '{\"required\":\"0\",\"rule\":\"\"}',
'2024-01-02 17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507046', '50', 'maxTokens',
'maxTokens', 2, 1, 5, '{\"required\":\"0\",\"rule\":\"\",
\"placeholder\":\"optional,0,0.01~1\"}', '2024-01-02 17:20:50.233', '2024-01-02
17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507047', '50', 'stream',
'stream', 3, 1, 6, '{\"defaultValue\":\"false\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371600', '50',
'proxyEnabled', 'proxyEnabled', 2, 1, 7,
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1722804548510507048', '50', 'prompt',
'prompt', 2, 1, 8, '{\"required\":\"0\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
+INSERT INTO `plugin_handle` VALUES ('1899802529972371600', '50',
'proxyEnabled', 'proxyEnabled', 2, 1, 7,
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1899802529972371601', '50',
'fallbackEnabled', 'fallbackEnabled', 2, 1, 9,
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1899802529972371602', '50',
'fallbackProvider', 'fallbackProvider', 2, 1, 10,
'{\"required\":\"0\",\"placeholder\":\"OPENAI\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1899802529972371603', '50',
'fallbackBaseUrl', 'fallbackBaseUrl', 2, 1, 11,
'{\"required\":\"0\",\"rule\":\"\"}', '2024-01-02 17:20:50.233', '2024-01-02
17:20:50.233');
@@ -1419,14 +1418,6 @@ INSERT INTO `plugin_handle` VALUES
('1899802529972371604', '50', 'fallbackApiKey
INSERT INTO `plugin_handle` VALUES ('1899802529972371605', '50',
'fallbackModel', 'fallbackModel', 2, 1, 13,
'{\"required\":\"0\",\"placeholder\":\"gpt-4.1\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1899802529972371606', '50',
'fallbackTemperature', 'fallbackTemperature', 1, 1, 14, '{\"required\":\"0\"}',
'2024-01-02 17:20:50.233', '2024-01-02 17:20:50.233');
INSERT INTO `plugin_handle` VALUES ('1899802529972371607', '50',
'fallbackMaxTokens', 'fallbackMaxTokens', 1, 1, 15, '{\"required\":\"0\"}',
'2024-01-02 17:20:50.233', '2024-01-02 17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371601', '50',
'fallbackEnabled', 'fallbackEnabled', 2, 1, 9,
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371602', '50',
'fallbackProvider', 'fallbackProvider', 2, 1, 10,
'{\"required\":\"0\",\"placeholder\":\"OPENAI\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371603', '50',
'fallbackBaseUrl', 'fallbackBaseUrl', 2, 1, 11,
'{\"required\":\"0\",\"rule\":\"\"}', '2024-01-02 17:20:50.233', '2024-01-02
17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371604', '50',
'fallbackApiKey', 'fallbackApiKey', 2, 1, 12,
'{\"required\":\"0\",\"rule\":\"\"}', '2024-01-02 17:20:50.233', '2024-01-02
17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371605', '50',
'fallbackModel', 'fallbackModel', 2, 1, 13,
'{\"required\":\"0\",\"placeholder\":\"gpt-4.1\",\"rule\":\"\"}', '2024-01-02
17:20:50.233', '2024-01-02 17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371606', '50',
'fallbackTemperature', 'fallbackTemperature', 1, 1, 14, '{\"required\":\"0\"}',
'2024-01-02 17:20:50.233', '2024-01-02 17:20:50.233');
-INSERT INTO `plugin_handle` VALUES ('1899802529972371607', '50',
'fallbackMaxTokens', 'fallbackMaxTokens', 1, 1, 15, '{\"required\":\"0\"}',
'2024-01-02 17:20:50.233', '2024-01-02 17:20:50.233');
-
INSERT INTO `plugin_handle` VALUES ('1722804548510507049', '51', 'database',
'database', 1, 3, 2,
'{\"required\":\"0\",\"defaultValue\":\"0\",\"rule\":\"\"}', '2022-05-25
18:02:53', '2022-05-25 18:02:53');
INSERT INTO `plugin_handle` VALUES ('1722804548510507050', '51', 'master',
'master', 2, 3, 3, '{\"required\":\"0\",\"rule\":\"\"}', '2022-05-25 18:02:53',
'2022-05-25 18:02:53');
diff --git a/db/init/og/create-table.sql b/db/init/og/create-table.sql
index 99455e3206..932dd7b449 100644
--- a/db/init/og/create-table.sql
+++ b/db/init/og/create-table.sql
@@ -264,7 +264,7 @@ COMMENT ON COLUMN "public"."field"."model_id" IS 'this
field belongs to which mo
COMMENT ON COLUMN "public"."field"."self_model_id" IS 'which model of this
field is';
COMMENT ON COLUMN "public"."field"."name" IS 'field name';
COMMENT ON COLUMN "public"."field"."field_desc" IS 'field description';
-COMMENT ON COLUMN "public"."field"."required" IS 'whether to require (0 not
required, 1 required)';
+COMMENT ON COLUMN "public"."field"."is_required" IS 'whether to require (0 not
required, 1 required)';
COMMENT ON COLUMN "public"."field"."ext" IS 'extended fields,can store
genericTypes,eg..{"genericTypes":[model_id1,model_id2]}';
COMMENT ON COLUMN "public"."field"."date_created" IS 'create time';
COMMENT ON COLUMN "public"."field"."date_updated" IS 'update time';
@@ -444,7 +444,7 @@ COMMENT ON COLUMN "public"."param"."model_id" IS 'the model
id, empty if not a m
COMMENT ON COLUMN "public"."param"."type" IS
'0-requestPathVariable,1-requestUrlParam,2-requestHeader,3-requestBody,4-responseHeader,5-responseBody';
COMMENT ON COLUMN "public"."param"."name" IS 'the param name';
COMMENT ON COLUMN "public"."param"."param_desc" IS 'the param description';
-COMMENT ON COLUMN "public"."param"."required" IS 'whether to require (0 not
required, 1 required)';
+COMMENT ON COLUMN "public"."param"."is_required" IS 'whether to require (0 not
required, 1 required)';
COMMENT ON COLUMN "public"."param"."ext" IS 'extended fields';
COMMENT ON COLUMN "public"."param"."date_created" IS 'create time';
COMMENT ON COLUMN "public"."param"."date_updated" IS 'update time';
@@ -2449,10 +2449,10 @@ CREATE TABLE "public"."discovery" (
)
;
COMMENT ON COLUMN "public"."discovery"."id" IS 'primary key id';
-COMMENT ON COLUMN "public"."discovery"."name" IS 'the discovery name';
+COMMENT ON COLUMN "public"."discovery"."discovery_name" IS 'the discovery
name';
COMMENT ON COLUMN "public"."discovery"."discovery_level" IS '0 selector,1
plugin 2 global';
COMMENT ON COLUMN "public"."discovery"."plugin_name" IS 'the plugin name';
-COMMENT ON COLUMN "public"."discovery"."type" IS
'local,zookeeper,etcd,consul,nacos';
+COMMENT ON COLUMN "public"."discovery"."discovery_type" IS
'local,zookeeper,etcd,consul,nacos';
COMMENT ON COLUMN "public"."discovery"."server_list" IS 'register server url
(,)';
COMMENT ON COLUMN "public"."discovery"."props" IS 'the discovery pops (json) ';
COMMENT ON COLUMN "public"."discovery"."namespace_id" IS 'namespace id';
diff --git a/db/init/oracle/schema.sql b/db/init/oracle/schema.sql
index 315f754aa7..7aeb47b46c 100644
--- a/db/init/oracle/schema.sql
+++ b/db/init/oracle/schema.sql
@@ -710,7 +710,7 @@ comment on column PARAM.name
is 'the param name';
comment on column PARAM.param_desc
is 'the param description';
-comment on column PARAM.required
+comment on column PARAM.is_required
is 'whether to require (0 not required, 1 required)';
comment on column PARAM.ext
is 'extended fields';
@@ -881,7 +881,7 @@ comment on column FIELD.name
is 'field name';
comment on column FIELD.field_desc
is 'field description';
-comment on column FIELD.required
+comment on column FIELD.is_required
is 'whether to require (0 not required, 1 required)';
comment on column FIELD.ext
is 'extended fields,can store
genericTypes,eg..{"genericTypes":[model_id1,model_id2]}';
@@ -2649,7 +2649,7 @@ create table discovery
-- Add comments to the columns
comment on column DISCOVERY.id
is 'primary key id';
-comment on column DISCOVERY.name
+comment on column DISCOVERY.discovery_name
is 'the discovery name';
comment on column DISCOVERY.discovery_level
is '0 selector,1 plugin 2 global';
@@ -2657,7 +2657,7 @@ comment on column DISCOVERY.plugin_name
is 'the plugin name';
comment on column DISCOVERY.namespace_id
is 'namespace id';
-comment on column DISCOVERY.type
+comment on column DISCOVERY.discovery_type
is 'local,zookeeper,etcd,consul,nacos';
comment on column DISCOVERY.server_list
is 'register server url (,)';
@@ -3221,15 +3221,15 @@ VALUES ('1844026099075534857', '1844026099075534849',
'SHENYU.BUTTON.PLUGIN.RULE
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO "resource" (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
VALUES ('1844026099075534858', '1844026099075534849',
'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0,
'plugin:aiProxy:modify', 1);
-INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO resource (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
+INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO "resource" (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
VALUES ('1844026099075534900', '1844026099075534849',
'SHENYU.BUTTON.AI.PROXY.APIKEY.ADD', '', '', '', 2, 0, '', 1, 0,
'system:aiProxyApiKey:add', 1);
-INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO resource (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
+INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO "resource" (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
VALUES ('1844026099075534901', '1844026099075534849',
'SHENYU.BUTTON.AI.PROXY.APIKEY.LIST', '', '', '', 2, 1, '', 1, 0,
'system:aiProxyApiKey:list', 1);
-INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO resource (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
+INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO "resource" (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
VALUES ('1844026099075534902', '1844026099075534849',
'SHENYU.BUTTON.AI.PROXY.APIKEY.EDIT', '', '', '', 2, 2, '', 1, 0,
'system:aiProxyApiKey:edit', 1);
-INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO resource (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
+INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO "resource" (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
VALUES ('1844026099075534903', '1844026099075534849',
'SHENYU.BUTTON.AI.PROXY.APIKEY.DELETE', '', '', '', 2, 3, '', 1, 0,
'system:aiProxyApiKey:delete', 1);
-INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO resource (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
+INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(resource(id)) */ INTO "resource" (id,
parent_id, title, name, url, component, resource_type, sort, icon, is_leaf,
is_route, perms, status)
VALUES ('1844026099075534904', '1844026099075534849',
'SHENYU.BUTTON.AI.PROXY.APIKEY.DISABLE', '', '', '', 2, 4, '', 1, 0,
'system:aiProxyApiKey:disable', 1);
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(permission(id)) */ INTO permission (id,
object_id, resource_id)
diff --git a/db/init/pg/create-table.sql b/db/init/pg/create-table.sql
index 132be93d10..d1e0130fd3 100644
--- a/db/init/pg/create-table.sql
+++ b/db/init/pg/create-table.sql
@@ -261,7 +261,7 @@ COMMENT ON COLUMN "public"."field"."model_id" IS 'this
field belongs to which mo
COMMENT ON COLUMN "public"."field"."self_model_id" IS 'which model of this
field is';
COMMENT ON COLUMN "public"."field"."name" IS 'field name';
COMMENT ON COLUMN "public"."field"."field_desc" IS 'field description';
-COMMENT ON COLUMN "public"."field"."required" IS 'whether to require (0 not
required, 1 required)';
+COMMENT ON COLUMN "public"."field"."is_required" IS 'whether to require (0 not
required, 1 required)';
COMMENT ON COLUMN "public"."field"."ext" IS 'extended fields,can store
genericTypes,eg..{"genericTypes":[model_id1,model_id2]}';
COMMENT ON COLUMN "public"."field"."date_created" IS 'create time';
COMMENT ON COLUMN "public"."field"."date_updated" IS 'update time';
@@ -441,7 +441,7 @@ COMMENT ON COLUMN "public"."param"."model_id" IS 'the model
id, empty if not a m
COMMENT ON COLUMN "public"."param"."type" IS
'0-requestPathVariable,1-requestUrlParam,2-requestHeader,3-requestBody,4-responseHeader,5-responseBody';
COMMENT ON COLUMN "public"."param"."name" IS 'the param name';
COMMENT ON COLUMN "public"."param"."param_desc" IS 'the param description';
-COMMENT ON COLUMN "public"."param"."required" IS 'whether to require (0 not
required, 1 required)';
+COMMENT ON COLUMN "public"."param"."is_required" IS 'whether to require (0 not
required, 1 required)';
COMMENT ON COLUMN "public"."param"."ext" IS 'extended fields';
COMMENT ON COLUMN "public"."param"."date_created" IS 'create time';
COMMENT ON COLUMN "public"."param"."date_updated" IS 'update time';
@@ -2572,11 +2572,11 @@ CREATE TABLE "public"."discovery" (
)
;
COMMENT ON COLUMN "public"."discovery"."id" IS 'primary key id';
-COMMENT ON COLUMN "public"."discovery"."name" IS 'the discovery name';
+COMMENT ON COLUMN "public"."discovery"."discovery_name" IS 'the discovery
name';
COMMENT ON COLUMN "public"."discovery"."discovery_level" IS '0 selector,1
plugin 2 global';
COMMENT ON COLUMN "public"."discovery"."plugin_name" IS 'the plugin name';
COMMENT ON COLUMN "public"."discovery"."namespace_id" IS 'the namespace id';
-COMMENT ON COLUMN "public"."discovery"."type" IS
'local,zookeeper,etcd,consul,nacos';
+COMMENT ON COLUMN "public"."discovery"."discovery_type" IS
'local,zookeeper,etcd,consul,nacos';
COMMENT ON COLUMN "public"."discovery"."server_list" IS 'register server url
(,)';
COMMENT ON COLUMN "public"."discovery"."props" IS 'the discovery pops (json) ';
COMMENT ON COLUMN "public"."discovery"."date_created" IS 'create time';
diff --git
a/shenyu-infra/shenyu-infra-etcd/src/test/java/org/apache/shenyu/infra/etcd/client/EtcdClientTest.java
b/shenyu-infra/shenyu-infra-etcd/src/test/java/org/apache/shenyu/infra/etcd/client/EtcdClientTest.java
index a100b7a354..7f9da1ad1c 100644
---
a/shenyu-infra/shenyu-infra-etcd/src/test/java/org/apache/shenyu/infra/etcd/client/EtcdClientTest.java
+++
b/shenyu-infra/shenyu-infra-etcd/src/test/java/org/apache/shenyu/infra/etcd/client/EtcdClientTest.java
@@ -49,7 +49,10 @@ import static org.mockito.Mockito.when;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
+@MockitoSettings(strictness = Strictness.LENIENT)
@ExtendWith(MockitoExtension.class)
public class EtcdClientTest {